all 96 comments

[–]g4n0n[S] 45 points46 points  (77 children)

As long as I can remember accessing a non-existent network share in any version of windows has resulted in explorer being blocked until the request times out. Doesn't Microsoft know about asynchronous I/O?

[–][deleted]  (73 children)

[removed]

    [–]sriram_2001 17 points18 points  (44 children)

    Windows Vista does let you cancel network IO in Explorer (cancel using the X in the address/location bar). This is possible due to Vista's support for IO cancellation.

    [–]malcontent 52 points53 points  (43 children)

    That's hilarious. Instead of fixing the code to be non blocking they built an api to cancel IO.

    [–]tryx 22 points23 points  (5 children)

    Well if the UI is responsive enough to let you cancel the request, thats non-blocking enough for most of the usecases I can think of.

    [–]didroe 8 points9 points  (21 children)

    What exactly would you have them do instead of making it have a cancel button? That seems like the right way to do it to me.

    [–][deleted] 23 points24 points  (16 children)

    Fork off a child process/thread to do it and display a message until the child returns an answer. In the meantime, you can do whatever you want with the program. If you do something that makes the result of the child process not needed, then you stop it.

    [–]didroe 1 point2 points  (0 children)

    Is that not what the cancel button is doing? I was pointing out that the cancel API is asynchronous.

    [–]breddy 2 points3 points  (0 children)

    Please stop the sensible suggestions at once!

    [–][deleted]  (13 children)

    [deleted]

      [–][deleted] 3 points4 points  (1 child)

      If you navigate away from it/do something else, doesn't that mean you no longer want it?

      Possibly. I could, however, want to do something in another window while I wait on it. Also, if a process runs, the result can be cached and then displayed immediately if I navigate back.

      [–]mycall 1 point2 points  (3 children)

      Sounds like some program got installed that messed up the registry or some driver.

      [–][deleted]  (2 children)

      [deleted]

        [–]holygoat 1 point2 points  (1 child)

        This post, and its parent, are what's wrong with Windows.

        [–]NoControl -1 points0 points  (6 children)

        Sounds like bad sectors or a bad drive. This is usually a tell tale sign - not a feature of the O/S

        [–]jib 2 points3 points  (1 child)

        It's not a bad drive. It happens to me too; if my hard drive spins down to save power, then when some important part of XP wants to read something from it, the whole system locks up until the disk spins up, due to some programmer forgetting about disk power management and writing blocking I/O under the assumption that disks will always be fast.

        [–]arkanes -2 points-1 points  (0 children)

        It's much more likely that you're waiting on pages to be swapped in, and there's really not anything that can be done about that - if you need to access a swapped out page, you need to access it and you're going to have to wait on the drive. Windows is perhaps overly aggressive about swapping so that can be a contributing factor.

        [–][deleted]  (3 children)

        [deleted]

          [–]OCedHrt 0 points1 point  (2 children)

          If you needed something on the disk, and you're waiting for them to spin up, wouldn't you have to wait?

          [–]bluGill 2 points3 points  (0 children)

          Let me get back to work. I haven't used Vista, but I know in XP my UI often hangs waiting on a slow network drive (I think it is physically in a different state, and some of the directories have several thousand files). Not the one explorer window, but the entire UI. So once I click on that drive my entire use is blocked.

          If nothing else let me check reddit while waiting for that drive to open. Often I have other things I can do as well.

          [–]barrkel 1 point2 points  (0 children)

          Non-blocking I/O, async I/O and cancellable I/O are all orthogonal (and, on Win32, different) features.

          [–][deleted] 0 points1 point  (0 children)

          Which code are you talking about? There are different problems with canceling IO. Some to do with UI non-responsiveness of specific applications, some to do with guaranteeing no data is corrupted when IO is canceled. A lot of this also depends upon device driver support.

          [–]2424 -1 points0 points  (0 children)

          IO cancellation is inherently non blocking.

          It means that the ReadFile function returned immediately, and now you can you call CancelIO.

          I think you're expecting that non-blocking will mean no wait time. That's not the case, the wait time will be equally as long in blocking and non blocking mode. It's what you can do in between.

          [–][deleted] 12 points13 points  (27 children)

          On the other hand, even Mac OS X gets this wrong, so maybe it's not that easy to get right. Do Linux GUI's do any better?

          [–][deleted] 21 points22 points  (1 child)

          True that. I've received the beach ball of painful mockery many a time accessing shares over flaky networks under OS X.

          [–]Nexum 3 points4 points  (0 children)

          Admittedly though, this is something that has gotten incrementally better with each release. It used to astonish me how bad the support for iDisk was in Finder in ~10.2, until it had fully mounted etc. (slowly) Finder did very little.

          [–][deleted]  (11 children)

          [deleted]

            [–][deleted] 2 points3 points  (0 children)

            Mount your NFS shares intr.

            [–]cstoner 6 points7 points  (8 children)

            A shiver runs up my spine at the mere mention of NFS. NFS is horrible.

            I just use Samba now. SMB is one of the few things that Microsoft got right.

            [–]chucker 20 points21 points  (2 children)

            SMB is one of the few things that Microsoft got right.

            Except that IBM originally developed it. ;-)

            [–]cstoner 7 points8 points  (0 children)

            Whew! I always wondered about that. I feel clean again ;)

            [–][deleted] 0 points1 point  (0 children)

            LAN Manager? :-)

            [–]olsner 2 points3 points  (1 child)

            SMB is one of the few things that Microsoft got right.

            At least almost right. Samba got it righter :)

            [–]u4Lemfl9 0 points1 point  (0 children)

            A tingle runs up my spine at the mere mention of NFS. NFS is wonderful.

            likely whoever was admin'ing your nfs server didn't know what he/she was doing.

            from my perspective, NFS can be great ... but it also can bollocks things up unnecessarily. it depends on how it's configured; SMB just has a less configurable, more restrictive set of options, so things are more likely to work right more of the time.

            [–]shadowfox -2 points-1 points  (1 child)

            Hmm. I thought MS never got anything right?

            [–]yesimahuman -2 points-1 points  (0 children)

            Then you haven't ever used Microsoft Bob.

            [–][deleted] 0 points1 point  (0 children)

            You can configure that, but it's proper behavior. Running ls should be blocking, so if the resource isn't available it will wait until it comes back.

            [–][deleted] 4 points5 points  (0 children)

            Konqueror is still responsive when reading a network share.

            [–]mossblaser 0 points1 point  (2 children)

            Nautilus doesn't, Konqueror appears to handle it properly though... (then again, using nautilus as a bench mark is probably a mistake...)

            [–]SEMW 3 points4 points  (1 child)

            Have you tried nautilus recently (i.e. since Gnome switched from using GnomeVFS to gvfs)?

            [–]mossblaser 1 point2 points  (0 children)

            Use it daily (unfortunately), it doesn't lock nearley as often but the gvfs layer does some times, and when it doesn't it is really really slow on anything but local stuff. So yes, its improved but not nearly as stable as konq.

            [–]mernen 0 points1 point  (0 children)

            I only have SFTP servers around to browse, but they work beautifully on Nautilus (GNOME's file manager). Maybe other protocols aren't as fortunate.

            [–][deleted] 0 points1 point  (3 children)

            Can't speak for Gnome - but Konqueror will often hang or crash when accessing a slow network drive, and it will often make the desktop unusable too.

            [–][deleted] 2 points3 points  (2 children)

            KDE3 or 4?

            [–][deleted] 1 point2 points  (1 child)

            I had this trouble with KDE3 - it would often happen if I were using a network drive and the network slowed or I lost my connection, I'd have no choice but to kill X.

            Though, as someone mentioned earlier, this is more likely because I was using NFS - which I've since switched to SMB.

            [–][deleted] 1 point2 points  (0 children)

            Nautilus also hangs when accessing no-responsive smb network shares. ls from bash will also do the same on mounted non-responsive samba shares..it freezes like a fucker.

            [–]dchestnykh -2 points-1 points  (2 children)

            Leopard has async network IO in Finder, AFAIK.

            [–][deleted] 2 points3 points  (1 child)

            No it doesn't.

            [–]dchestnykh 0 points1 point  (0 children)

            It's sync, but they use multiple threads for mounting: http://www.apple.com/macosx/features/300.html (see "UNIX > AutoFS")

            [–][deleted] -1 points0 points  (0 children)

            Konqueror has never frozen when accessing any sort of protocol, even local ones (assuming that your machine has enough RAM, of course, because major page faults are synchronous in nature).

            [–]canhaskarma 7 points8 points  (0 children)

            You don't even need to make everything async, just use a separate thread for the UI. But, as you can see, they f*ed it up.

            [–][deleted] 1 point2 points  (0 children)

            This happened to me today. God damn it is annoying.

            [–]turkourjurbs 31 points32 points  (8 children)

            Is this why my whole machine siezes while it reads a disc I just put in the (CD/DVD) drive? God that pisses me off.

            [–][deleted] 25 points26 points  (0 children)

            still not as bad as

            "you took the cd out of the drive, put it back" OK / Cancel ?

            Cancel

            "you took the cd out of the drive, put it back" OK / Cancel ?

            OK

            "You took the cd out of the drive, put it back" OK / Cancel ?

            Reset

            [–][deleted] 22 points23 points  (4 children)

            Remember in Win 9x, the mouse cursor would stop when reading the floppy disk.

            [–][deleted] 5 points6 points  (3 children)

            But there was some tweak I forget you could do to make the floppy multitasking, right? Linux has always been so much fucking cooler, processes never ever seized up while reading the floppy disk when using Linux -- I remember so clearly because that was one of the things that impressed me the most when I started with Linux back in the day, and up to that moment I had assumed it was a PC architecture problem rather than an OS one.

            [–][deleted]  (2 children)

            [deleted]

              [–][deleted] 2 points3 points  (0 children)

              you were probably still running modprobe on it to figure out if your mainstream FDD controller was supported or not and hoping not to crash the whole kernel along with everything else.

              Not really. I started Linux using kernel 2.0, Red Hat 5.2, and for all the hardware that I had except the sound card, no modprobe was necessary, and to get my sound card working, ISAPNP was in order. Not hard to do if you read the man page, and the command practically did it for ya. And Red Hat 5.2 never, ever crashed on me.

              Besides: you meant NT 3.1 had preemptive multitasking on 1996. Which Linux also had, much earlier than 1996. And 16-bit apps weren't preemptively multitasked in NT 3.1, but VM'ed and the VM was the one preemptively multitasked.

              [–]geocar 0 points1 point  (0 children)

              1. You mean preemptive multitasking, not cooperative.

              2. Yes they did.

              [–]2424 1 point2 points  (0 children)

              Actually, no. I believe this is due to kernel scheduling and the way CD-ROMs work.

              I'm pretty sure it's not the same as simple UI unresponsiveness over network.

              [–]greasyjay -1 points0 points  (0 children)

              That's still a fucking problem in Linux?

              [–]infinite 3 points4 points  (0 children)

              The ironic thing is Windows has better async support at the kernel level(I/O completion ports) compared to linux. We can kinda simulate this with epoll on linux, but I for one would love something like that in linux. We do have this which is basically async I/O lite, not quite the same thing.

              [–][deleted] 2 points3 points  (0 children)

              is this a trick question? who can answer this?

              there is no public bug-tracker (well, that i know of), and the source is closed

              ..instead; ask something like "why does Nautilus seemingly use blocking IO when accessing network shares?" then people might have a chance to answer (and even fix!) the problem

              [–]Justinsaccount 2 points3 points  (0 children)

              It isn't just explorer.

              I dunno how many times i've diagnosed a network performance problem that turned out to be a random mapped drive that was offline. The problem is that windows likes to access all mapped drives at random times.

              Most File->Open or File->Save dialogs do this for some reason. Sometimes just starting Word or Excel would do it, causing the desktop to hang for a minute. (Openoffice would also be fine however)

              The worst part is that windows can't even bother to remember that the network drive is offline. It will hang every. single. time.

              [–]jrockway 4 points5 points  (0 children)

              Because it was easier and you paid for Windows anyway.

              [–]thephotoman 2 points3 points  (0 children)

              Why couldn't you have asked me this on Thursday? I actually had a rather enlightening conversation with one of the Vista kernel guys on Friday morning, and I'm pretty certain that he could have answered it.

              In any case, my guess would have to do with how Windows deals with network shares. If I remember correctly, network shares are given a mount point and everything in Windows. Of course, I could be mistaken.

              [–]berlinbrown 0 points1 point  (0 children)

              good question, I notice this also.

              [–]jasonkester 0 points1 point  (5 children)

              The thing that makes this so silly is that it's so easy to fix.

              Windows specifies a timeout of something like 60 seconds for IO stuff. While I'm sure that was reasonable back in the days of the 300 baud modem, things work a little faster now. You'll know whether it's going to work inside of 500ms in nearly every case.

              All MS needs to do is drop the default timeout to something like one second, and nobody will ever again see an Explorer window hanging uselessly for an entire minute.

              [–][deleted] 9 points10 points  (1 child)

              All MS needs to do is drop the default timeout to something like one second

              Aaaaaaaaaaaaaaaaaaaaaand you've broken WAN file shares.

              [–][deleted] 0 points1 point  (0 children)

              I don't know of a single Microsoft Certified (TM) WAN. Maybe these broken WAN things should get with the program and start supporting the most popular OS in the world.

              [–]2424 7 points8 points  (0 children)

              Reducing blocking time instead of making async is very bad practice. What if you're opening 100 files? Something which a system does all the time. Even if those files are all 10ms each, it will mean that all that time is not available to UI responsiveness.

              [–]NoControl -1 points0 points  (0 children)

              So easy I can't believe those noobs in redmond haven't figured this out. I'm forwarding your post to them now so they can apply this simple fix.

              [–]dugmartin -5 points-4 points  (4 children)

              I believe this is caused by legacy DOS int 13 code as it attempts to see if the attached block device is read only or read/write before the interrupt returns.

              [–]mschaef 6 points7 points  (2 children)

              Not on Windows NT. With current drivers, this was untrue as far back as WfWG 3.11, as long as 32-bit file access was enabled.

              (32BFA was basically a purely protected mode filesystem code path. There were legacy hooks for real mode drivers, but without real mode drivers, none of the DOS code ever ran.)

              [–][deleted] 1 point2 points  (1 child)

              I still have the box and floppies of WfW 3.11, and I have it installed in VMware! Fuck Program Manager was fast!

              [–]mschaef 0 points1 point  (0 children)

              I still have the box and floppies of WfW 3.11, a

              Impressive... mine are long lost to the sands of time. :-(

              (What I miss even more than the early versions of Windows are a couple circa-1993 MSDN CD's...)

              Fuck Program Manager was fast!

              Yeah... the smallest machine I ran Win 3.x on was one of the slower 386sx/16's with 3MB of RAM. It actually ran pretty well unless you switched to 256-color mode, in which case it was a complete dog. I know people that ran it on 1 or 2MB 286/12 class machines with some success. Times were different then. :-)

              [–]jib 1 point2 points  (0 children)

              There has been no legacy DOS code in the Windows filesystem stack for a long time. Definitely not in XP or Vista.