albertz / music-player

Music player - endlessly plays your music
http://albertz.github.io/music-player/
BSD 2-Clause "Simplified" License
492 stars 59 forks source link

search can take long and block #26

Closed albertz closed 11 years ago

albertz commented 11 years ago

This is because the fileid module might take very long in some cases. In this case, this seem to be because on MacOSX, it might try to mount another network volume to search for some resources and the timeout is high.

Multiple things to make better:

The C backtrace:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8a54dd46 __kill + 10
1   libsystem_c.dylib               0x00007fff85d948ea _sigtramp + 26
2   libsystem_kernel.dylib          0x00007fff8a54c686 mach_msg_trap + 10
3   com.apple.NetAuth               0x00007fff89509800 NAAA_MountURL + 250
4   com.apple.NetAuth               0x00007fff895071e7 _NetAuthConnectToServerSync + 363
5   com.apple.NetAuth               0x00007fff89507061 NAConnectToServerSync + 97
6   com.apple.NetFS                 0x00007fff860320f0 NetFSMountURLWithAuthenticationSync + 106
7   com.apple.NetFS                 0x00007fff860309ed netfs_MountURLWithAuthenticationSync + 155
8   com.apple.CoreServicesInternal  0x00007fff839c7ce9 CFURLCreateByResolvingDataInBookmark(__CFAllocator const*, BookmarkData&, unsigned int, unsigned long, __CFArray const*, unsigned char*, __CFError**) + 4811
9   com.apple.CoreServicesInternal  0x00007fff839c6698 _CFURLCreateByResolvingBookmarkData + 3042
10  com.apple.CoreFoundation        0x00007fff8ecac3fe +[NSURL URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:] + 78
11  libffi.dylib                    0x00007fff8236dde4 ffi_call_unix64 + 76
12  libffi.dylib                    0x00007fff8236e619 ffi_call + 853
13  _objc.so                        0x00000001026dd663 PyObjCFFI_Caller + 1980
14  _objc.so                        0x00000001026f243e 0x1026c3000 + 193598
15  org.python.python               0x000000010001caba PyObject_Call + 97
16  org.python.python               0x0000000100020225 PyEval_EvalFrameEx + 8032
17  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
18  org.python.python               0x000000010005df78 0x100009000 + 348024
19  org.python.python               0x000000010001caba PyObject_Call + 97
20  org.python.python               0x000000010001ec59 PyEval_EvalFrameEx + 2452
21  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
22  org.python.python               0x000000010005df78 0x100009000 + 348024
23  org.python.python               0x000000010001caba PyObject_Call + 97
24  org.python.python               0x000000010001ec59 PyEval_EvalFrameEx + 2452
25  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
26  org.python.python               0x0000000100024661 0x100009000 + 112225
27  org.python.python               0x00000001000200d2 PyEval_EvalFrameEx + 7693
28  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
29  org.python.python               0x000000010005df78 0x100009000 + 348024
30  org.python.python               0x000000010001caba PyObject_Call + 97
31  org.python.python               0x0000000100023dfc PyEval_CallObjectWithKeywords + 177
32  org.python.python               0x0000000100013228 0x100009000 + 41512
33  org.python.python               0x0000000100020041 PyEval_EvalFrameEx + 7548
34  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
35  org.python.python               0x0000000100024661 0x100009000 + 112225
36  org.python.python               0x00000001000200d2 PyEval_EvalFrameEx + 7693
37  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
38  org.python.python               0x000000010005df78 0x100009000 + 348024
39  org.python.python               0x000000010001caba PyObject_Call + 97
40  org.python.python               0x000000010001ec59 PyEval_EvalFrameEx + 2452
41  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
42  org.python.python               0x000000010005df78 0x100009000 + 348024
43  org.python.python               0x000000010001caba PyObject_Call + 97
44  org.python.python               0x0000000100023dfc PyEval_CallObjectWithKeywords + 177
45  org.python.python               0x0000000100013228 0x100009000 + 41512
46  org.python.python               0x0000000100020041 PyEval_EvalFrameEx + 7548
47  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
48  org.python.python               0x000000010005df78 0x100009000 + 348024
49  org.python.python               0x000000010001caba PyObject_Call + 97
50  org.python.python               0x000000010001ec59 PyEval_EvalFrameEx + 2452
51  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
52  org.python.python               0x0000000100024661 0x100009000 + 112225
53  org.python.python               0x00000001000200d2 PyEval_EvalFrameEx + 7693
54  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
55  org.python.python               0x0000000100024661 0x100009000 + 112225
56  org.python.python               0x00000001000200d2 PyEval_EvalFrameEx + 7693
57  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
58  org.python.python               0x0000000100024661 0x100009000 + 112225
59  org.python.python               0x00000001000200d2 PyEval_EvalFrameEx + 7693
60  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
61  org.python.python               0x000000010005df78 0x100009000 + 348024
62  org.python.python               0x000000010001caba PyObject_Call + 97
63  _objc.so                        0x00000001026d8898 0x1026c3000 + 88216
64  libffi.dylib                    0x00007fff8236e8a6 ffi_closure_unix64_inner + 508
65  libffi.dylib                    0x00007fff8236df66 ffi_closure_unix64 + 70
66  com.apple.CoreFoundation        0x00007fff8ec2a47a _CFXNotificationPost + 2554
67  com.apple.Foundation            0x00007fff867c7846 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
68  com.apple.AppKit                0x00007fff84c0a260 -[NSTextView(NSSharing) didChangeText] + 339
69  com.apple.AppKit                0x00007fff84c07b88 -[NSTextView insertText:replacementRange:] + 2335
70  com.apple.AppKit                0x00007fff84cbc200 -[NSTextInputContext handleTSMEvent:] + 2781
71  com.apple.AppKit                0x00007fff84cbb6fa _NSTSMEventHandler + 202
72  com.apple.HIToolbox             0x00007fff8e16df0a DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1206
73  com.apple.HIToolbox             0x00007fff8e16d3d9 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 410
74  com.apple.HIToolbox             0x00007fff8e1831bd SendEventToEventTarget + 40
75  com.apple.HIToolbox             0x00007fff8e1636b2 SendTSMEvent + 35
76  com.apple.HIToolbox             0x00007fff8e163230 SendUnicodeTextAEToUnicodeDoc + 477
77  com.apple.HIToolbox             0x00007fff8e162f62 TSMKeyEvent + 610
78  com.apple.HIToolbox             0x00007fff8e1b31b5 TSMProcessRawKeyEvent + 2568
79  com.apple.AppKit                0x00007fff84cba347 -[NSTextInputContext handleEvent:] + 823
80  com.apple.AppKit                0x00007fff84cb9f87 -[NSView interpretKeyEvents:] + 183
81  com.apple.AppKit                0x00007fff84c06f67 -[NSTextView keyDown:] + 723
82  com.apple.AppKit                0x00007fff84e22120 -[NSWindow sendEvent:] + 9687
83  com.apple.AppKit                0x00007fff84e1d744 -[NSApplication sendEvent:] + 5761
84  com.apple.AppKit                0x00007fff84d332fa -[NSApplication run] + 636
85  libffi.dylib                    0x00007fff8236dde4 ffi_call_unix64 + 76
86  libffi.dylib                    0x00007fff8236e619 ffi_call + 853
87  _objc.so                        0x00000001026dd663 PyObjCFFI_Caller + 1980
88  _objc.so                        0x00000001026f243e 0x1026c3000 + 193598
89  org.python.python               0x000000010001caba PyObject_Call + 97
90  org.python.python               0x0000000100020225 PyEval_EvalFrameEx + 8032
91  org.python.python               0x00000001000245eb 0x100009000 + 112107
92  org.python.python               0x00000001000200d2 PyEval_EvalFrameEx + 7693
93  org.python.python               0x000000010001e281 PyEval_EvalCodeEx + 1956
94  org.python.python               0x000000010001dad7 PyEval_EvalCode + 54
95  org.python.python               0x0000000100054933 0x100009000 + 309555
96  org.python.python               0x00000001000549ff PyRun_FileExFlags + 165
97  org.python.python               0x00000001000543e9 PyRun_SimpleFileExFlags + 410
98  albertzeyer.MusicPlayer         0x0000000100001f54 main + 682 (main.m:67)
99  albertzeyer.MusicPlayer         0x0000000100001c6d _start + 203
100 albertzeyer.MusicPlayer         0x0000000100001ba1 start + 33

And Python backtrace:

Current thread 0x00007fff72a08180:
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/fi...", line 38 in getPathByNativeId
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/ut...", line 1185 in decoratedFunc
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/ut...", line 1044 in decoratedFunc
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/so...", line 438 in remapFilename
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/so...", line 441 in getBestSongFileFromDict
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/so...", line 473 in getSongSummaryDictById
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/so...", line 208 in decorated
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/so...", line 796 in search
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/so...", line 208 in decorated
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/Se...", line 21 in searchText
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/gu...", line 320 in onTextChange
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/gu...", line 111 in textDidChange_
  File "/Users/az/Programmierung/music-player/mac/build/Release/MusicPlayer.app/Contents/Resources/Python/gu...", line 1155 in main
  File "main.py", line 37 in <module>
albertz commented 11 years ago

The fileid mount block is fixed in commit 6a5a5fe66d8b. The async search is implemented in commit 21007ed758 (and following which remove the async interrupt because of issues - see comments in source).