4 ms·
When I acquire a mutex inside my callback, it deadlocks. Microsoft wrote the calling function and the mutex implementation! Stupid Microsoft! Never mind that m
by asveikau 13y ago
When I acquire a mutex inside my callback, it deadlocks. Microsoft wrote the calling function and the mutex implementation! Stupid Microsoft!
Never mind that my callback violated the caller's threading model and that mutices introduce deadlocks when used incorrectly... They should fix the bug!
Edit: I guess what I was trying to say is that this part needs a huge "citation needed":
> was almost certainly built ... according to Microsoft guidelines
We don't know that at all. When you insert your code into another process, bugs in your code have the potential to destabilize that process. This discussion is extremely light on details but we cannot assume that the caller, rather than the callee, is at fault. If it's working correctly with another driver, I say, look at the suspicious driver, it's likely got a bug.
- lisper 13y agoWhen was the last time you saw a mutext deadlock that could be worked around by moving the mouse? You're right that this discussion is light on details, but there is one relevant detail from which reasonable conclusions can be drawn: there is a workaround that involves moving the mouse around continuously. I can't think of any plausible scenario that could produce that behavior that does not involve some blatantly horrible design decision by Microsoft (hence "their fault"). It's possible that such a scenario exists, but I can't think of one, and I have not seen any such plausible scenario proposed by anyone else. I also know that Microsoft products are chock-full of blatantly horrible design decisions. In particular, Windows tightly couples the graphical UI with the OS kernel in a way that other OSes do not. It seems to me exceedingly likely that whatever is causing this problem has something to do with that.
- asveikau 13y agoElsewhere on this thread there is the suggestion that this could have to do with improper use of message pumps... Message pumps as a concept has equivalents in pretty much every UI framework I've looked at. (Some examples: run loops in Cocoa, g_main_loop in glib/Gtk+) If you violate the run loop's threading requirements it's not totally inconceivable that a mouse event could affect behavior. I suggest it might be helpful to learn how the system works before you bash it.
- lisper 13y agoI am familiar with the design of message queues, though not specifically with the design of Windows message pumps. > If you violate the run loop's threading requirements it's not totally inconceivable that a mouse event could affect behavior. That's true. But the possibility remains that the design of Windows message queues is so byzantine and imposes so many arcane requirements on the developer that it is easy to miss something. In which case the question of fault is still arguable even if the immediate bug is in Oracle's code. I have a very hard time imagining any circumstances under which an OS could allow a mouse event to impact a database driver -- even if the database driver is buggy -- and still be considered well (or even reasonably) designed. But I'm certainly open to the possibility that I've overlooked something.
- lafar6502 13y agoYou overlooked the fact that programming model of windowed/GUI applications is quite complex and very sensitive to non-cooperative code - a thread that frequently blocks for 100 ms can cause very unpleasant hiccup. Introduction of OLE/COM interprocess communication mechanism made things worse as one unresponsive application could block other programs and halt their message loops. But it was quite efficient and you didn't have to spin up multiple threads to have multitasking in your application.
- lisper 13y ago> You overlooked the fact that programming model of windowed/GUI applications is quite complex and very sensitive to non-cooperative code - a thread that frequently blocks for 100 ms can cause very unpleasant hiccup. No, I didn't overlook this. But this is 2013. IMO, a multitasking architecture that is "sensitive to non-cooperative code" ought to be considered broken, and so if that's the cause of this problem, that still counts as Microsoft's fault in my book.
- nknighthb 13y agoIt's now 2014, actually, and you're talking about a problem from 1997, in an OS where backwards compatibility has been an extremely high priority since the 1980s.
- barrkel 13y agoIt seems clear that the window message pump was being used by the Oracle driver in a way that made it break when hosted in a GUI application. Message pumps are not atypical of event-driven GUIs on many different platforms, and problems with multithreading abound everywhere shared memory is the default. IMO it's a big stretch to try and blame MS for this.
- lisper 13y ago> It seems clear that the window message pump was being used by the Oracle driver in a way that made it break when hosted in a GUI application. It's not clear to me, but maybe you know something I don't. What is it exactly that makes this clear? And what is the "way" in which the message pump is being used that makes it break in a GUI app?