Forum Archive

Stash git push -> crash

mikael

Just checking with you esteemed peers - suddenly git push just crashes my Pythonista, on a newly created repository and latest version of Stash.

Others seeing the same the behaviour?

Thanks!

JonB

can you enable the fault handler (see dgelessus's pythonista_startup repo) and post the traceback?

Are you pushing a large file of some sort?

dgelessus

(Here's the "easy installation" version of the faulthandler - copy and paste the code into your pythonista_startup.py: https://gist.github.com/dgelessus/fe8e267149862eb67127f4fff7e017be)

mikael

Thank you for the help. Here are the results:

Fatal Python error: Aborted

Thread 0x000000016e22f000 (most recent call first):

------------------------------------------------------------------------

Objective-C exception details:

NSInvalidArgumentException: -[__NSCFData UTF8String]: unrecognized selector sent to instance 0x1702c16d0

Stack trace:

0   CoreFoundation                      0x000000018b792ff8 <redacted> + 148
1   libobjc.A.dylib                     0x000000018a1f4538 objc_exception_throw + 56
2   CoreFoundation                      0x000000018b799ef4 <redacted> + 0
3   CoreFoundation                      0x000000018b796f54 <redacted> + 916
4   CoreFoundation                      0x000000018b692d4c _CF_forwarding_prep_0 + 92
5   Py2Kit                              0x00000001021bc3f8 keychain_get_services + 384
6   Py2Kit                              0x00000001023683f0 PyEval_EvalFrameEx + 15064
7   Py2Kit                              0x000000010236bb34 fast_function + 280
8   Py2Kit                              0x0000000102367b34 PyEval_EvalFrameEx + 12828
9   Py2Kit                              0x00000001023645e8 PyEval_EvalCodeEx + 2092
10  Py2Kit                              0x00000001023690f8 PyEval_EvalFrameEx + 18400
11  Py2Kit                              0x00000001023645e8 PyEval_EvalCodeEx + 2092
12  Py2Kit                              0x000000010236ba8c fast_function + 112
13  Py2Kit                              0x0000000102367b34 PyEval_EvalFrameEx + 12828
14  Py2Kit                              0x00000001023645e8 PyEval_EvalCodeEx + 2092
15  Py2Kit                              0x000000010236ba8c fast_function + 112
16  Py2Kit                              0x0000000102367b34 PyEval_EvalFrameEx + 12828
17  Py2Kit                              0x00000001023645e8 PyEval_EvalCodeEx + 2092
18  Py2Kit                              0x00000001022ecf84 function_call + 152
19  Py2Kit                              0x00000001022c4190 PyObject_Call + 124
20  Py2Kit                              0x0000000102367d08 PyEval_EvalFrameEx + 13296
21  Py2Kit                              0x000000010236bb34 fast_function + 280
22  Py2Kit                              0x0000000102367b34 PyEval_EvalFrameEx + 12828
23  Py2Kit                              0x000000010236bb34 fast_function + 280
24  Py2Kit                              0x0000000102367b34 PyEval_EvalFrameEx + 12828
25  Py2Kit                              0x00000001023645e8 PyEval_EvalCodeEx + 2092
26  Py2Kit                              0x00000001022ecf84 function_call + 152
27  Py2Kit                              0x00000001022c4190 PyObject_Call + 124
28  Py2Kit                              0x00000001022d233c instancemethod_call + 188
29  Py2Kit                              0x00000001022c4190 PyObject_Call + 124
30  Py2Kit                              0x000000010236b42c PyEval_CallObjectWithKeywords + 192
31  Py2Kit                              0x00000001023a2e54 t_bootstrap + 84
32  libsystem_pthread.dylib             0x000000018a85568c <redacted> + 240
33  libsystem_pthread.dylib             0x000000018a85559c <redacted> + 0
34  libsystem_pthread.dylib             0x000000018a852cb4 thread_start + 4

End of exception details.

Umm... Something to do with threading?

mikael

I re-installed stash which also redownloaded dulwich. Still crashes.

I am working with only small text files at the moment.

I will try with another repo... Still crashes.

JonB

What iOS version are you using?

Seems like one of the stash objc calls is crashing. Not sure what it could possibly be... unless you are using one of ios betas, where maybe something has been depreciated...

IiRc stash has a debug logging mode which logs all objc calls, so we can see what is crashing specifically. Check the stash repo issues list, ywangd walked someone through this once...

mikael

@JonB, thanks.

I am running the latest iOS 10, non-beta.

I searched the stash issue list for 'log' and 'debug', but could not find anything like you described.

Meanwhile, concerned for the safety of my code and to get the larger binaries working, I jumped ship to Working Copy. Not nearly as convenient as stash, but workable.

JonB

in launch stash, add 'stdout':false to log_setting.

log_setting = {
    'level': ns.log_level,
    'file': ns.log_file,
    'stdout':False
}

Then uncomment all or some of the debug settings in the next block. Finally, run with arguments (long press play) --log-level DEBUG

This should log to stash.log in Documents.

JonB

Does

>> import keychain
>>> keychain.get_services()

crash? That is maybe the objc call crashing...

mikael

@JonB, yes, it does crash, with the same exception and identical fault data.

JonB

Ahh. Okay, this is an @omz question then -- keychain probably should not be crashing!

which pythonista version are you using? (beta/app store version)

mikael

@JonB, I am using the latest App Store version 3.1, which has not been updated for months, while this problem just appeared.

JonB

I have read a few places that keychain implementations might crash with ios10 if keychain sharing is not enabled by the developer. It is strange if it is just starting to crash and was working before. have you changed any icloud settings?
You could also try keychain.reset_keychain() -- maybe something got corrupted

mikael

That did the trick.

get_services now works, and git push as well.

Of course, all the passwords are gone, but I think corrupted keychain would have been a bigger pain going forward.

Sincere thanks for leading me to the root cause.