If you move your mouse continually the query may not fail. Do not stop moving
support.microsoft.com
support.microsoft.com
It happened to me because I had a hidden window on the background thread to get WM events for USB disconnect and reconnect messages from the system. The bug report was funny. "Connecting USB data collection probe doesn't work unless the user moves the mouse after connecting." and the follow up bug "Data collection only works when moving the mouse."
Draining the message queue from a thread that doesn't own it makes absolutely no sense to me ... Does that actually work? Wouldn't you see the messages on the original thread's pump too? I thought the way it worked is each thread with ui objects has a queue, and SendMessage et al. will insert into the owning thread's queue. It took me a while to parse what you are saying, did you pass the hwnd into GetMessage from the other thread and that somehow convinced it to peek at another thread's queue?
I actually like windows as a user, but I'm amazed that it won as much developer mindshare as it did considering how much the win32 api sucks. It's brutal.
Don't know that I'd call COM "elegant", but you could probably do worse for a language-agnostic object system. Funny enough, I never really "got" COM until I sat down and read up on Bonobo. Someone had a really accessible explanation for Monikers that would've saved me so much hair-pulling if I'd had anything similar for the Windows equivalent.
Apple choose KHTML over Gecko for it's Webkit fork [2] because of the various cons of such component models.
[1] Bonobo is officially deprecated: http://en.wikipedia.org/wiki/Bonobo_(component_model)
I think COM's biggest sin was doing all this stuff without language support. It's just not sensible to graft interfaces and automatic memory management onto C without modifying the language. Objective-C is basically a slightly more duck typed COM, but it's not nearly as reviled because the object model is so deeply integrated into the language.
As noted, GNOME deprecated Bonobo even though the GNOME name was meant to emphasize the CORBA/Bonobo aspect of things (Gnu Object Manipulation Environment). Mozilla spent a lot of effort removing gratuitous use of XPCOM ( https://wiki.mozilla.org/Gecko:DeCOMtamination ).
I think the ugliness is due to threading issues and being welded on to Win32 message pumps. If you have a dedicated COM thread/pool you'll mostly be fine (security stuff can still get complicated). But on the other hand if you start doing COM things on a thread you own where you share control of the message pumping, you open yourself to a world of mental anguish.
Excel 2010 still relies on WinAPI's Fibers [1] (lightweight threads). In recent years the idea got popular again with Lua's co-routines and GO's goroutines.
So it is manually scheduled by the application, instead of relying on the OS.
In 2014, there is a lot of code in Excel that dates back to Excel 3 (1990). Excel 2010 still relied on the outdated MDI concept [2] that had been introduced with Win 3 and only one Excel instance/main window can run.
One can embed the Excel OLE component in one app [3]. As soon as the component get the focus it replaces the traditional menu bar with the custom drawn "ribbon bar". It looks weird out of place (Win9x style OLE app with ribbon bar). Office apps started with custom drawn UI objects with Office 97. It had these fancy toolbars and a italic window title [4] instead of the boring Win95 look that WinAPI provided.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ms68... ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms68...
[2] http://en.wikipedia.org/wiki/Multiple_document_interface
[3] e.g. using the sample apps that come "Inside OLE 2nd" book.
I have never been able to remember how Excel and Word for Windows handle multiple windows, as it changed in subtle ways (can you alt-tab between Excel documents. Between Word ones? Do documents appear in the taskbar, or windows, or just Excel?) between versions, as Word and Excel within an Office version do not appear to behave 100% the same, and I as I tended to encounter different versions, for example when helping a friend, or when using RDP to a different server (yes, we had servers with Office installed, and we didn't even use them for COM controls) at work.
IIRC opening up Excel again from the start menu didn't create a new instance, it just gave focus to the document/instance I had open. My jaw kinda dropped cause it wasn't like I had an extremely uncommon use case. There was no File > Open new window. I tried dragging the document to outside, like you can do in Firefox with a tab, nope. Opening a new document simply opened it in the current instance I had running. I needed to do a compare side by side of the documents. Switching between them didn't cut it.
Btw this is a different problem with Excel and Office all together - I was using Excel 2007 because the files I was using were created in 2007 and used a customer (who had only 2007) and would mess up if you saved them in a later version. The files had some complicated macros in them. Compatibility Mode (I think that's what they called it) WAS NOT actually compatible!! 2010 was out, and I had that installed as well, but 2007 had to be the one I used for this task.
I was just doing some simple maintenance operations on them. I had nothing to do with their evil creation.
There was some way to eventually get Excel 2007 to run two instances of itself, but like I said, it was a hack that I found online after a bunch of searching.
It's still ridiculous behaviour, and drives me crazy because on a typical day I'll have a minimum of 3 spreadsheets open (3 sheets I always need quick access to) and often 10-20, and it can be a real pain in the ass remembering which sheets are in which instance, leading to regularly needing to close a sheet, start a new excel instance, then re-open the sheet in that, whenever I want to look at it side by side to another sheet. And even more annoying, if I'm opening a sheet that's an email attachment, I can't just open direct from Outlook, I have to save it locally so I can make sure to open it in the correct instance.
There's also this weird thing about how it thinks you want to shut down spreadsheets. I always forget which way is which, but sometimes it thinks you want to shut just the active sheet, sometimes it thinks every sheet you have open (in that excel instance). Just checked here and it doesn't seem to be the case on my home PC (Office Professional Plus 2010), but it definitely does on my work laptop. I think it's different behaviour between the X in the top right, double clicking the top left logo, and using alt+F4, I just can't remember which is which. But any logic would say that if you're showing multiple windows on the task bar, telling one to close doesn't mean close the others, and I think this is essentially tied to the same issue with trying to view sheets side by side.
I've never had issues with Word as others mentioned, though - possibly due to luck with versions I've used, or maybe I just don't have to compare two word documents side by side as often as I do with spreadsheets.
*can't find a reference for that, so I may be off.
The dumbest customer will guess that a "solution" like that from support can only come from a design that sucks.
If it were a refrigerator instead of a spreadsheet it would be like support telling you that you have to keep petting the door of your refrigerator to keep it cooling.
Who is the crazy there?
After that, I don't think anything somebody reports as a Windows application bug could make me think they're crazy.
Later I became lazy and just pressed the ctrl or shift key. I still do it when watching movies with mplayer or in something browser-based (that does not disable the screenlock automatically).
P.S. I'm also slightly(?) OCDish in preferring selections that are integer fractions of the paragrah length. E.g. in a paragraph of 6.3 lines I'll tend to select 2.1 lines at a time (not _that_ precisely of course).
Might be, but is it a good sign for computer industry as a whole?
But the trend is more to hire more and more novice programmers (because they are cheaper) ... so we get more into trouble in the future!
Aspiring programmers could learn a lot from the demoscene, where astonishingly impressive things are done with very little code and complexity.
[1] https://support.microsoft.com/kb/276304
Edit: typo
Wow. The story behind the extra 1625 characters must be good.
like bot detection on NT-based systems? Yes, lets not talk about that.
If you're playing with Oracle data that often, you're probably an enterprise customer who's going to buy the next version anyway.
It's not like this was happening every time you wanted to save or copy/paste data.
It's still kind of embarrassing.
Maybe not the fault of Microsoft?
I guess if it's an event loop thing one could also alternate 'z' and 'x' as fast as possible :-)
My "first love" in OS's is AmigaOS, and while the OS is very dated in many ways (no memory protection, no SMP support), one of the things it really got right was to encourage extremely extensive multithreading. On Amiga's it was a necessity if you wanted to have full multitasking, as the machines were slow enough and memory constrained enough that not doing it would severely limit usability (frankly, it would have done PC's a world of good too, but the PC world took the simpler approach of not even trying for proper multi-tasking).
My favourite example is how cut and paste from the console worked.
It includes the device handlers handling keyboard and mouse input, the intuition input handler, which processes the raw input events and turns them into input events for specific windows, the console.device device handler which takes intuition events for console windows and "cooks" the events into higher level events that gets passed to the console-handler, which then will find the area you are selecting, and call a function that passes the buffer to the clipboard.device, which will then create a clipboard entry that gets written to a disk volume, which involves the filesystem handler for that filesystem, which again likely will involve a device suck as ram.device or trackdisk.device to write it to the actual device.
Every single one of these steps is handled by a separate thread/process (the distinction doesn't mean much on AmigaOS due to the lack of memory protection, and are usually referred to as "task" instead).
The reason for this is all down to responsiveness: The input devices and things like trackdisk.device musc deal with hardware, and so must have priority. But if the rest of the flow was given high priority, the system would be sluggish, so the minimum amount of work is done, put into a message, tacked onto a queue, and things are off to a start.
At the opposite end, things like clipboard.device must not lock up when clipboard entries are added, as while the clipboards are usually in RAM:, they are files on a filesystem, and a user with only 512KB RAM and possibly no harddrive might in fact be using a floppy drive for the clipboard - forcing the user to wait for a floppy write would have been intolerable (and why Amiga users loved to mock Windows 3.x users back in the day).
This permeated through many applications as well. It was a matter of pride for many developers, and the first chapters in many Amiga developer books tended to involve Exec (Amiga's "kernel", or parts of it) which provided a set of library functions for managing messages, lists of messages and message ports, as they were essential for talking to the OS, but also readily available for application developers. For many, before you'd written your first "hello world" app you had gotten a crash course in making things asynchronous by default.
Today a day go by for me without either my browser freezing, or Thunderbird freezing or some other application, both on Linux at home and OS X at work. And on the few occasions I've had to work on Windows machines, there too. Every time it happens, I dream wistfully about a world where people understood how to write software that way.
It is, in fact, not all that hard: "All it takes" is to subdivide your application into smaller components that only communicate using async message queues. Incidentally it makes the apps easier to test too, and easier to make robust (unlike under AmigaOS, on a modern OS you can separate components on process boundaries where it makes sense too, and automatically restart failed components), and it makes it easy to make them scriptable etc.
Ah, the MS OS/2 2.0 fiasco. I wrote before about http://www.groklaw.net/pdf/iowa/www.iowaconsumercase.org/011... and how it ignores the limitations of the 32-bit Windows extenders, including the lack of preemptive multitasking.
Historically, it was even worse: all desk accessories on Mac OS where running as load able drivers (http://www.folklore.org/StoryView.py?story=Desk_Ornaments.tx.... Aside: that article shows that Jobs did actually design a GUI, that for the calculator. More info at http://www.folklore.org/StoryView.py?project=Macintosh&story...)
I think windows wasn't much different. There is/was an article about the mess that Microsoft's build system for Windows was that explains how they spent lots of effort fixing layer violations in order to improve build times (they used to have full builds only novice every few months. That meant that incompatibilities between, say, an improved menu system and the latest version of the Explorer would take months to surface). Anybody remember that?
Anytime they start indexing or re-indexing a huge code base in a "background" thread, they end up locking the machine to varying extents. Linux is not as bad, as it only tends to lock up instances of the offending application... But that maybe because the Linux PC is a beefy workstation. OS X is on a much less powerful MacBook Pro, and freezes tend to lock up the whole system, or at least most of the other apps, especially Chrome.
I've also had problems with Chrome, and especially Flash, on OS X. Spinning beachballs on every page load. Click-to-flash was such a lifesaver, but I can now sorta see why Steve Jobs wanted Flash dead.
The spinning beachball has grown to be a frequent source of rage for me over the last 5 years. I'm surprised nobody else complains about it more. Maybe it only happens for heavy Java GUI-based apps?
IntelliJ IDEA should run such background threads with lower priority! All common OS support that, and also Java supports this: http://stackoverflow.com/questions/1617963/setting-priority-...
Can someone file a bug for it?
The only Java app I use is BucketExplorer though, which isn't very heavy.
X11 is supposed to be multithreaded enough to allow this and it worked fine on older versions of Xlib, before the libxcb transition.
Fixed by using select() in the event loop for the curious: https://github.com/lcrs/6ilk/commit/d5c39abde09e0467a8a4d17d...
This isn't too uncommon, actually, but what usually happens is that the company with the upper hand prevails and the other one has to fix the bugs, lest they piss off their customers who have to leave. However, when both companies keep their users in tight vendor lockdowns, they just wave their cocks around for a few months blaming each other and settle for the users working around, since it's the cheapest alternative.
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.
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.
I suggest it might be helpful to learn how the system works before you bash it.
> 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.
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.
Is that really the kind of discussion you want this to be?
> you're talking about a problem from 1997,
The last revision of the article is 2002. But your point is well taken. I had assumed this was a current issue. (Maybe it is. I don't have time to dig into those details right now.)
> in an OS where backwards compatibility has been an extremely high priority since the 1980s
OS X was introduced in 2001, and it could run OS 9 applications, so these kinds of problems can be solved if a company decides it is worthwhile to solve them.
Yes. If you're going to chastise people based on what year it is, you damn well better be right about what year it is.
> OS X was introduced in 2001, and it could run OS 9 applications
OS X booted a modified copy of OS 9 to accomplish that. It didn't fix anything about OS 9. It also wasn't present on Intel Macs, nor on Leopard, the last PowerPC-compatible version of OS X. Nor was it fully compatible -- I always had trouble with it, and have kept older System 7 and OS 9 Macs around rather than put up with it.
Kidding aside, I can't help but think that you keep going back to that "clearly the mutex is broken" analogy I mentioned earlier. If I read you correctly, it doesn't matter if the Oracle code is breaking the rules set out by the MS documentation, Microsoft should account for all possible bugs past, present and future and prevent them. Seems like that's asking a lot. The other platforms I've worked with don't seem to satisfy this either.
What bothers me more, though, is how preemptively dismissive you've been about Win32 while showing something of a lack of knowledge on how it works. I don't think Win32 is perfect. (Ask me about filesystem behaviors some time.) At the same time I have gotten to know it and can appreciate areas where it works well. I would also hope that before making the kinds of comments you are making about any platform, I'd get to know the framework a bit better first.
I might not be able to show you such a toolkit, but I can certainly show you an operating system that allows you to write a database driver whose behavior is not affected by the user moving the mouse.
> it doesn't matter if the Oracle code is breaking the rules set out by the MS documentation
Of course it matters. I just couldn't imagine what rule there could possibly be that is both 1) broken by a database driver and 2) reasonable, that could possibly result in said driver displaying the behavior in question. (I can imagine such a rule now because to3m pointed out a reasonable possibility in another branch of this thread.)
> how preemptively dismissive you've been about Win32 while showing something of a lack of knowledge on how it works
I freely confess to being (at least potentially) prejudiced against Microsoft's technology by my anger at the fact that they reached market dominance by breaking the law. As a result of that prejudice, I have maintained a carefully cultivated ignorance of all things Microsoft -- until recently. In the past weeks I have found myself in a position where I had to do some Windows development for the first time in my career. So I am far from an expert, but I do now speak from firsthand experience when I say that, in my humble opinion, Windows is every bit the horrible monstrosity on the inside as it has always appeared to me to be on the outside. And, BTW, my opinion is shared by colleagues who know a lot more about it than I do. So yes, my opinion on this is not as well informed as it might or should be, but I have not reached in a total vacuum either.
(The Windows message queue is actually fairly straightforward, and if you read the documentation then it's simpler still. The somewhat magical WM_PAINT message is a bit ugly, but aside from that it's actually quite difficult to get things massively wrong. Which is probably why this sort of freakish bug is rather rare.)
if(dataAvailable())
fetchData();
and assumed regular window messages to drive execution of this process. If you don't move the mouse or do anything else with the window, no messages are sent to it (unless a timer or something else does) and the message loop just waits for the next message, so that code doesn't get run. If you move the mouse around in the window a constant stream of WM_MOUSEMOVE will drive the loop. Polling really shouldn't be done in the main message loop; one way to fix this is to move to a completely event-driven system where dataAvailable() sends a message that causes the main loop to run fetchData().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?
1. http://simhq.com/forum/files/usergals/2013/02/full-4656-5091...
The fix was telling them to stop doing that. :)
At first this may seem totally bullshitty: Imagine a download manager. Do you really want the download to pause every time you open a context menu? Well it turns out it is not such a bad idea in many cases: What if the context menu allows you to cancel the download? If the download were to go on in the background you would have to explicitly take care of that. If you tie the networking callbacks to your main runloop this simply can't happen.
Of course there are also a lot of use cases where you want your networking code to not have anything to do with your main runloop...
If you are running your network code in default mode on the main thread (problematic doing that and it's probably better to use async methods these days) then yes that can happen but it's usually programmer error.
On Mac, entering a modal window will usually put the runloop in a context that regular events won't fire and only those that mater to the modal window will fire. Commons mode almost always fires though.
I work on Apportable (YC2011) and we have reimplemented CFRunLoop/NSRunLoop down to the bare metal. A lot of misconceptions on how it works we find.
I am aware of what you mention in your answer. In my statement I simplified quite a bit. I know that runloops have different modes. What I was saying is that if you just use the "defaults" then you will see the phenomenon that I described.
And I don't think that it is a programmer error if you use the defaults... but sure: These days you would probably just use a framework or take care of these details...
May I know why you have reimplemented CFRunLoop?
We make Objective-C run on Android at Apportable :-) The entire stack. Everything from clang, GCD, CoreFoundation, Foundation, UIKit, and dozens of comm frameworks. It's fairly popular with game developers.
We recently re-developed all of Foundation from scratch on top of the parts of CFLite that Apple open sources and no longer use GNUStep.
http://docs.apportable.com/release-notes.html#1100
We have even open sourced all our tests around Foundation as well and this is one of them. Check it out:
Your idea is somewhat similar to "our" idea... at Objective-Cloud we try to bring Objective-C to the cloud... :) You try to bring it to Android. What a coincidence. Nice to meet you. :)
It's usually a programmer error when you write code that does something other than what you intend, regardless of whether or not what you intend to do is the default behaviour.
I think this is perfectly understandable behaviour for a framework of such a general purpose. The whole convention over configuration thing works for tools like Ruby on Rails and web2py. 90% of the applications written using them are pretty much identical and the non-technical constraints favour quick delivery over well-adapted architecture, so you can afford making it obnoxiously hard for the rest of 10%.
But both OS X and iOS are preemptive. Networking just keeps working, but your interface thread may stop for a while depending on how you write your programs.
That's not the OS's fault; that's "just" bad programmers, and just as trivial to do wrong on Linux or any other OS.
Eventually, you will be kicking yourself for not having made it right the first time.
The corollary is that eventually we will all be running Plan 9, so there are probably other factors at play as well, which I will quietly brush under the carpet, like air friction in a high school physics question. ;)
I don't know what causes this kind of issue but I remember using this workaround at times since windows 95. It somehow prevented freezes of either application or windows from happening.
On the other hand, jiggling the mouse around can also trigger the adverse effect of crashing some other apps under others conditions such as loading screen during games.
IE has still the same UI mouse feeling of Spyglass Mosaic. IE 1 started with its source code and even after the major improvements of IE 3 it still feels very similar. (IE up to IE 6 mentioned "Spyglass source code" on the about dialog.)
Even the print preview window of IE 11 looks like the same window in NCSA Mosaic 2 (1995) (I just downloaded and run on it on Win7)
The trouble with today's computing is: Just to much complexity around (starting from the OS, and that is also valid for Linux, I must say!) and to few really good programmers that make things better (and not worse). I see also in the Linux world to much complexity and to few real professionals.
Real professionals don't try to handle complexity -- they try to minimize it!
It's all well and good to say "Just keep it simple!" It's another to implement that.
I built and maintain a fairly popular RubyMotion library. It's goal is pretty simple: DSL out the ViewController hierarchy management and make it manageable for the application developer.
Every bit of code I add to what is now a fairly mature and full featured system pains me. But every bit of code addresses some edge case that we didn't think of, but which is quite valid.
An OS (like Linux, Unix, Windows) has orders of magnitude more issues to deal with than I do. In order to keep the system simple for users, they often have to add complexity to their code.
Simple for users just isn't the same as simple under the hood.
Right, and exactly that is the reason, why we are in desperate need for really professional computer scientists (or programmers, how you want to name it). But the trend is the other way around. Everybody is searching for the quick solution and the cheapest programmers, or hackers (I even see many job offers that go in the direction hacker rather than professionals).
It takes a real professional to cope with the complexity and reduce it to the minimal value. But in our current trend, we will thinks getting worse and worse, because we have far to much coding and far to less professionals (and even they can't afford to make a clean job oftentimes).
Agency url: http://www.sat.gob.mx/sitio_internet/home.asp
> Occasionally for no reason whatsoever, you car would lock the door and refuse to let you in until you simultaneously lifted the door handle, turned the key, and grabbed hold of the radio antenna.
You mean it made you actually laugh out loud?
And yes of course providing a bug fix is better, but providing a workaround is always the first step. A workaround is plenty good enough for many people for whom updating is more risk and hassle.
The whole thing reminds me a bit of the classic "known knowns" episode with Rummy where he dared to bring some decision theory into an interview answer ( http://en.wikipedia.org/wiki/There_are_known_knowns ) The reaction to it really showed more about journalists than about the statement.
In the Windows NT series (4, 2000, XP, etc.) the sheduler gives the forground application an higher priority. It runs a longer CPU time than all other applications. This was probably also similar with Win 3 and 9x series but probably with many hacks and glue code on top of DOS.
Moving the mouse also prevented the screensaver, an application that would "save" the screen by drawing fancy graphics to prevent static phosphore burns on CRT monitor and slowed down the system
If I remember correctly, one of the first moves towards power-saving in the stock-OS was Win 95/98/ME (one of those) to start using the HLT instruction (stop processor up to next interrupt) in the main OS, was a busy loop until then.
Notebook manufacturers (I worked with machines from Toshiba and Compaq in the 90s...) provided DOS TSRs and windows applications and drivers to control the CPU speed and display brightness.
On a related note: isn't it interesting how this meme (mostly a placebo) traveled to the majority of computer users in a pre-internet age?
But yes, I have seen a similar case involving linux /dev/random - the user reported that outgoing emails were sometimes delayed for hours and that moving a mouse over a VNC window would sometimes speed it up. I did not believe that at first, but it was exim4 running out of entropy when generating TLS session keys. Worse, it was on a VPS with about 20 exim4 processes competing for the entropy.
It's an impedance mismatch, you have a long-running background operation (sql query) that is running within the context of an event driven system (a windowing GUI). In this case the problem is that the sub-system that runs the query will only receive cycles when the main thread for the app fires mouse events. This is due to poor application design, of course, though not necessarily to the extent that it may seem, sometimes this sort of thing can be a harder problem than it may seem.
Raymond Chen has a great example of a similar bug here: http://blogs.msdn.com/b/oldnewthing/archive/2005/02/17/37530...
My friend's dad, a Math/CS teacher, did not believe me until I showed him.
The first versions of Windows NT would crash if you moved the mouse while shutting down. Like a child throwing a tantrum because it's bed time...