Page 1 of 1

Strange access violations

Posted: 30.01.2006, 11:32
by matsgefvert
We're having problems with some of our software, which has been going on for a long time and quite frankly we're at our wits end here. :book:

Sometimes, very infrequently, something goes boom! And it always has to do with threaded applications. The programs work fine for hours, days... and then, suddenly, out of the blue, it crashes with access violations.

As far as we can see, we've made our programs as thread-safe as can reasonably be done. And while we're not looking specifically to blame the database components, we do rely heavily on them (Zeos 6.1.5, or 5.1) and it naturally arises as a cause of suspicion.

Has anyone else had problems with either libmysql40.dll or ZeosDBO in conjuction with threaded applications?

/ Mats

Posted: 30.01.2006, 13:09
by zippo
Sorry, never did threading with DB..

Posted: 31.01.2006, 15:55
by matsgefvert
Okay,

Just for all you guys who've been sitting on the edge of your seats now, biting your fingernails and desperately wondering if ZeosLib is stable enough for multithreaded development, the jury is in and has reached the following verdict:

ZeosLib is stable. :wohow:

Phew.

We finally located the problem and it turned out that there was one little icky component buried deep within the bowels of our system, that referenced a ZConnection object in a different thread. Which is really, really prohibited, although I'm not sure anyone ever told us that; I think we mostly figured that out as we went along. And, of course, it worked as long as two queries weren't using the same connection at the same time, which happened about once every hour or something.

So, as a general precaution, we've now applied a patch to ZConnection and ZAbstractROQuery, so that whenever a ZConnection is referenced from a thread that's different from the one that created it, it violently throws exceptions all around and displays big bad MessageBoxes with trace information. So if there's any more in there, we'll find them.

That's all. :bash: