r9389 hangs when doing "Move Data File To..."

Ask for help and report issues with the Mac OS X version of Transmission
Post Reply
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

r9389 hangs when doing "Move Data File To..."

Post by stern »

r9389 will reproducibly hang (stops responding, consumes 100% CPU) after you've clicked on the "Select" button in the file chooser. In one case the file was successfully moved and everything continued as normal after a restart, in another case the file was moved, but after restart Transmission was still looking for the file in the old location and the file had to be manually move back to its previous location (there does not seem to be a way to manually locate the data files in the OS X GUI).

Code: Select all

Sampling process 12572 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Transmission (pid 12572) every 1 millisecond
Call graph:
    2455 Thread_981052   DispatchQueue_1: com.apple.main-thread  (serial)
      2455 start
        2455 main
          2455 NSApplicationMain
            2455 -[NSApplication run]
              2455 -[NSApplication sendEvent:]
                2455 -[NSWindow sendEvent:]
                  2455 -[NSControl mouseDown:]
                    2455 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:]
                      2455 -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
                        2455 -[NSControl sendAction:to:]
                          2455 -[NSApplication sendAction:to:from:]
                            2455 -[NSApplication endSheet:returnCode:]
                              2455 -[NSSavePanel _didEndSheet:returnCode:contextInfo:]
                                2455 -[Controller moveDataFileChoiceClosed:returnCode:contextInfo:]
                                  2455 -[Torrent moveTorrentDataFileTo:]
    2455 Thread_981065   DispatchQueue_2: com.apple.libdispatch-manager  (serial)
      2455 start_wqthread
        2455 _pthread_wqthread
          2455 _dispatch_worker_thread2
            2455 _dispatch_queue_invoke
              2455 _dispatch_mgr_invoke
                2455 kevent
    2455 Thread_981071
      2455 thread_start
        2455 _pthread_start
          2455 ThreadFunc
            2455 libeventThreadFunc
              2455 event_dispatch
                2455 event_base_loop
                  2453 kq_dispatch
                    2453 kevent
                  2 timerCallback
                    1 bandwidthPulse
                      1 tr_bandwidthAllocate
                        1 allocateBandwidth
                          1 allocateBandwidth
                    1 reconnectPulse
                      1 tr_ptrArrayFindSorted
                        1 tr_ptrArrayLowerBound
                          1 handshakeCompareToAddr
    2455 Thread_981077
      2455 thread_start
        2455 _pthread_start
          2455 ThreadFunc
            2455 dht_bootstrap
              2455 select$DARWIN_EXTSN
    2455 Thread_981086
      2455 thread_start
        2455 _pthread_start
          2455 __NSThread__main__
            2455 -[UKKQueue watcherThread:]
              2455 kevent
    2455 Thread_981209
      2455 thread_start
        2455 _pthread_start
          2455 PrivateMPEntryPoint
            2455 TSystemNotificationTask::SystemNotificationTaskProc(void*)
              2455 CFRunLoopRun
                2455 CFRunLoopRunSpecific
                  2455 __CFRunLoopRun
                    2455 mach_msg
                      2455 mach_msg_trap
    2455 Thread_981219
      2455 thread_start
        2455 _pthread_start
          2455 __CFSocketManager
            2455 select$DARWIN_EXTSN
    2455 Thread_981220
      2455 thread_start
        2455 _pthread_start
          2455 __NSThread__main__
            2455 -[NSUIHeartBeat _heartBeatThread:]
              2454 usleep
                2445 nanosleep
                  2445 __semwait_signal
                9 cerror
              1 -[NSSet makeObjectsPerformSelector:]
                1 -[NSWindow flushWindow]
                  1 -[NSWindow isFlushWindowDisabled]
    895 Thread_981282
      895 start_wqthread
        895 _pthread_wqthread
          895 __workq_kernreturn
    855 Thread_981279
      855 start_wqthread
        854 _pthread_wqthread
          854 __workq_kernreturn
        1 _pthread_exit
          1 _pthread_free_pthread_onstack
            1 __spin_lock

Total number in stack (recursive counted multiple, when >=5):
        6       _pthread_start
        6       thread_start

Sort by top of stack, same collapsed (when >= 5):
        kevent        7363
        select$DARWIN_EXTSN        4910
        -[Torrent moveTorrentDataFileTo:]        2455
        mach_msg_trap        2455
        __semwait_signal        2445
        __workq_kernreturn        1749
        cerror        9
Sample analysis of process 12572 written to file /dev/stdout
livings124
Transmission Developer
Posts: 3142
Joined: Fri Jan 13, 2006 8:08 pm

Re: r9389 hangs when doing "Move Data File To..."

Post by livings124 »

How long did you wait?
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

Re: r9389 hangs when doing "Move Data File To..."

Post by stern »

I think around half a minute or so.
livings124
Transmission Developer
Posts: 3142
Joined: Fri Jan 13, 2006 8:08 pm

Re: r9389 hangs when doing "Move Data File To..."

Post by livings124 »

Was it a big file? It could have still been moving it.
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

Re: r9389 hangs when doing "Move Data File To..."

Post by stern »

Moving a small file (couple of hundred megs) on the same drive should not take that long and should definitely not make the UI lock up with a spinning beachball. If it does then that's a massive regression from earlier version.
livings124
Transmission Developer
Posts: 3142
Joined: Fri Jan 13, 2006 8:08 pm

Re: r9389 hangs when doing "Move Data File To..."

Post by livings124 »

Well the move code has been rewritten.
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

Re: r9389 hangs when doing "Move Data File To..."

Post by stern »

Well it seems to be broken.
Tantali
Posts: 5
Joined: Fri Sep 11, 2009 1:26 pm

Re: r9389 hangs when doing "Move Data File To..."

Post by Tantali »

Is still broken in the latest version (r9419)

Simply stated:
You move one or more files
Transmission wil move one of them and will then hang

So force quitting Transmission will let you end up with just one moved file.
That is, if nothing else went wrong...
Sometimes (or maybe it's only in the later builds) the torrent doesn't have a location set anymore after a force quit...

(Size, location or destination doesn't matter)

Edit: it also hangs when you're changing a torrents destination when no file is present at it's old destination
livings124
Transmission Developer
Posts: 3142
Joined: Fri Jan 13, 2006 8:08 pm

Re: r9389 hangs when doing "Move Data File To..."

Post by livings124 »

Can you try a current nightly and report back?
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

Re: r9389 hangs when doing "Move Data File To..."

Post by stern »

It is still broken. It does not appear to happen with a debug build, but always occurs with the "Release - Debug" configuration.
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

Re: r9389 hangs when doing "Move Data File To..."

Post by stern »

The problem is quite simple. In moveTorrentDataFileTo: you have this bit of code:

Code: Select all

    int status;
    tr_torrentSetLocation(fHandle, [folder UTF8String], YES, NULL, &status);
    while (status == TR_LOC_MOVING); //block while moving (for now)
The actual file move is done asynchronously in another thread, but the status word is not marked as volatile so the while()-loop will never end.
livings124
Transmission Developer
Posts: 3142
Joined: Fri Jan 13, 2006 8:08 pm

Re: r9389 hangs when doing "Move Data File To..."

Post by livings124 »

stern: Good point. Give 9467 a try and let us know. I'm not that experienced with "volatile", but it sounds like it might be it and would explain why it doesn't occur when I test it (I compile in Debug so it won't be optimized out).
stern
Posts: 61
Joined: Sat Aug 09, 2008 11:00 am

Re: r9389 hangs when doing "Move Data File To..."

Post by stern »

I already tested that making the status word volatile fixes the hang with a local build, I'll try your changes later.
Post Reply