Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite & windows: Not enough storage is available to complete this operation and CoInitialize has not been called

Some days ago I implemented a system for autocomplete suggestions which works with a dictionary depending on the language. Here is how it works: JQuery UI autocomplete -> call to .php file -> call to VB6 COM dll function -> call to .sqlite file and finding results based on typed letters -> return results to php -> return results to JS.

It works reasonably fast, as in, it takes on average ~7 (milliseconds) to complete each operation. During peak hours, google analytics shows ~1200 online users, and generally each day we get ~half a million calls to this particular function.

From the day this autocomplete suggestion system went online I started noticing hundreds of two very specific error messages:

Not enough storage is available to complete this operation.

CoInitialize has not been called.

Some information which may help:

a) These messages appear mostly during the peak visitors horus

b) They don't always appear only with the specific function, but on others as well (BUT never did before we implemented the aforementioned system)

c) I used sqlite databases before for other stuff (not as much "real-time" though, as in returning results when a user types) but never such a problem appeared

d) The size of the sqlite file is ~350MB with 3 tables, one of them has ~2,2 million entries, the other has 1,6 million and the other ~16thousand entries and all the necessary columns are indexed.

e) Obviously this database is used for read-only operations

f) Once the system gets disabled, all messages stop.

g) I get about a thousand such error messages each day for each message (with about 500.000 calls to the function / day)

The server system is two (x2) boxes: Core I7 4770 at 3,8GHZ, 32GB of RAM, Windows server 2012 and IIS.

The messages appear randomly and only during peak hours. I cannot replicate the problem at the development machine. Searching the internet has been fruitless till now. Any ideas on what's causing it and how to solve would be more than welcome.

Thank you.

like image 870
MirrorMirror Avatar asked Feb 10 '17 11:02

MirrorMirror


1 Answers

The fact this is a transient problem that only happens at peak usage times is a pretty clear indication something is running out of memory - probably your VB DLL (that's likely the only place where CoInitialize is being called).

I've seen similar problems with too many applications running and winDoze running out of "system handles" - I've got a w2K Advanced Server box I've been using as a desktop machine (because m$ doesn't provide an upgrade path from an AS instance to a desktop one) typically running a dozen Explorer windows, WinSCP with 8-10 tabs, several PuTTY sessions, several DOS boxes, remote desktop connections, Firefox with 184 tabs in 4 windows, Thunderbird watching 40 email accounts, WinAmp, and a few others - and PaintShopPro and PhpED just do not want to be running at the same time due to the aforementioned system handle limitation.

Your problems might be fixed simply by throwing more RAM at the issue, but you should probably do some performance checking, and check for system settings to tweak.

like image 171
FKEinternet Avatar answered Oct 05 '22 22:10

FKEinternet