Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SRWebSocket _pumpWriting] (SRWebSocket.m:1195) Crash #339

Closed
liujianan901228 opened this issue Mar 16, 2016 · 17 comments
Closed

[SRWebSocket _pumpWriting] (SRWebSocket.m:1195) Crash #339

liujianan901228 opened this issue Mar 16, 2016 · 17 comments
Assignees

Comments

@liujianan901228
Copy link

my app has this Crash.:
0 libsystem_platform.dylib 0x39627656 0x39626000 + 5718
1 CFNetwork 0x2e912f97 0x2e8de000 + 216983
2 CFNetwork 0x2e912cc3 0x2e8de000 + 216259
3 CFNetwork 0x2e9b6a5d 0x2e8de000 + 887389
4 CFNetwork 0x2e912c13 0x2e8de000 + 216083
5 CFNetwork 0x2e912b83 0x2e8de000 + 215939
6 CoreFoundation 0x2ec64f2b 0x2ec48000 + 118571
7 homework 0x001bec7b -SRWebSocket _pumpWriting
8 homework 0x001bd5e3 -SRWebSocket _writeData:
9 homework 0x001c02c3 -SRWebSocket _sendFrameWithOpcode:data:
10 libdispatch.dylib 0x394fc103 0x394fb000 + 4355
11 libdispatch.dylib 0x39500e77 0x394fb000 + 24183
12 libdispatch.dylib 0x394fdf9b 0x394fb000 + 12187
13 libdispatch.dylib 0x39501751 0x394fb000 + 26449
14 libdispatch.dylib 0x395019d1 0x394fb000 + 27089
15 libsystem_pthread.dylib 0x3962bdff 0x3962b000 + 3583
16 libsystem_pthread.dylib 0x3962bcc4 0x3962b000 + 3268

@dfed
Copy link
Contributor

dfed commented Mar 16, 2016

Can you include the entire crash report, including the actual exception that was thrown?

@liujianan901228
Copy link
Author

myapp=>-SRWebSocket _pumpWriting
App信息:
AppName: myapp
Version: 5.7.2
buildnumber: 235
Channel: AppStore
isPLCrash: YES
batVN: 1.0
其他附加信息:
refer:
uid:
uname:
crashAttachlog:
N/A
Crash Headers:
HardwareModel: iPad3,4
OS_Version: iPhone OS 7.0 (11A465)
Code_Type: ARM
Process: myapp [2619]
Path: /var/mobile/Applications/E0925AD5-457D-46AF-90B3-79AF05EC8387/myapp/myapp
Report_Version: 104
Exception_Type: SIGSEGV
Exception_Codes: SEGV_ACCERR at 0xc
Date_Time: 2016-03-16 14
serverTime: 2016-03-16 21:56:50
Crashed_Thread: 16
线程堆栈信息: 线下解析
Thread 0:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 SpringBoardServices 0x36b1b7cf 0x36b1a000 + 6095
2 UIKit 0x324a89ff 0x32495000 + 80383
3 UIKit 0x327043a9 0x32495000 + 2552745
4 UIKit 0x3270429d 0x32495000 + 2552477
5 UIKit 0x326a6991 0x32495000 + 2169233
6 UIKit 0x324a560b 0x32495000 + 67083
7 UIKit 0x324a4edd 0x32495000 + 65245
8 UIKit 0x3250aca1 0x32495000 + 482465
9 GraphicsServices 0x3495376d 0x3494b000 + 34669
10 GraphicsServices 0x34953357 0x3494b000 + 33623
11 CoreFoundation 0x2fce577f 0x2fc46000 + 653183
12 CoreFoundation 0x2fce571b 0x2fc46000 + 653083
13 CoreFoundation 0x2fce3ee7 0x2fc46000 + 646887
14 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
15 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
16 GraphicsServices 0x349522eb 0x3494b000 + 29419
17 UIKit 0x325051e5 0x32495000 + 459237
18 myapp 0x00109ab9 main (main.m:14)
19 libdyld.dylib 0x3a85aab7 0x3a859000 + 6839

Thread 1:
0 libsystem_kernel.dylib 0x3a8fe838 0x3a8fe000 + 2104
1 libdispatch.dylib 0x3a847643 0x3a845000 + 9795

Thread 2:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 CoreFoundation 0x2fce5561 0x2fc46000 + 652641
2 CoreFoundation 0x2fce3c81 0x2fc46000 + 646273
3 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
4 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
5 WebCore 0x37e0d7dd 0x37d4d000 + 788445
6 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
7 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
8 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 3:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 CoreFoundation 0x2fce5561 0x2fc46000 + 652641
2 CoreFoundation 0x2fce3c81 0x2fc46000 + 646273
3 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
4 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
5 Foundation 0x30689651 0x30631000 + 362065
6 Foundation 0x306fedc7 0x30631000 + 843207
7 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
8 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
9 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 4:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 CoreFoundation 0x2fce5561 0x2fc46000 + 652641
2 CoreFoundation 0x2fce3c81 0x2fc46000 + 646273
3 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
4 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
5 libAVFAudio.dylib 0x2ecbe5b3 0x2ecad000 + 71091
6 libAVFAudio.dylib 0x2ecb2bf7 0x2ecad000 + 23543
7 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
8 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
9 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 5:
0 libsystem_kernel.dylib 0x3a910f38 0x3a8fe000 + 77624
1 libsystem_pthread.dylib 0x3a978041 0x3a975000 + 12353
2 JavaScriptCore 0x30c7240d 0x30c61000 + 70669
3 JavaScriptCore 0x30c6fa73 0x30c61000 + 60019
4 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
5 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
6 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 6:
0 libsystem_kernel.dylib 0x3a910f38 0x3a8fe000 + 77624
1 libsystem_pthread.dylib 0x3a978041 0x3a975000 + 12353
2 JavaScriptCore 0x30e10af7 0x30c61000 + 1768183
3 JavaScriptCore 0x30e10b51 0x30c61000 + 1768273
4 JavaScriptCore 0x30c6fa73 0x30c61000 + 60019
5 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
6 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
7 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 7:
0 libsystem_kernel.dylib 0x3a911440 0x3a8fe000 + 78912
1 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
2 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
3 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 8:
0 libsystem_kernel.dylib 0x3a910f38 0x3a8fe000 + 77624
1 libsystem_pthread.dylib 0x3a978041 0x3a975000 + 12353
2 homework 0x0088c0ef _baidu_vi::CVEvent::Wait(unsigned int) + 183
3 homework 0x0088c381 _baidu_vi::CVThreadEvent::Wait() + 105
4 homework 0x0088c88d _baidu_vi::CVThreadEventMan::Wait(_baidu_vi::EN_THREAD_EVENT_TYPE) + 177
5 homework 0x00889925 _baidu_vi::CVSocketMan::SocketThreadProc(void*) + 1477
6 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
7 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
8 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 9:
0 libsystem_kernel.dylib 0x3a911550 0x3a8fe000 + 79184
1 libsystem_c.dylib 0x3a88243d 0x3a878000 + 42045
2 myapp 0x0088cc97 _baidu_vi::CVTimer::TimerProcess() + 131
3 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
4 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
5 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 10:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 CoreFoundation 0x2fce5561 0x2fc46000 + 652641
2 CoreFoundation 0x2fce3c81 0x2fc46000 + 646273
3 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
4 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
5 Foundation 0x3063c827 0x30631000 + 47143
6 myapp 0x0020b9c1 -_SRRunLoopThread main
7 Foundation 0x306fedc7 0x30631000 + 843207
8 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
9 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
10 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 11:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 CoreFoundation 0x2fce5561 0x2fc46000 + 652641
2 CoreFoundation 0x2fce3c81 0x2fc46000 + 646273
3 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
4 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
5 Foundation 0x3063c827 0x30631000 + 47143
6 Foundation 0x3068d669 0x30631000 + 378473
7 homework 0x0041e447 +AFURLConnectionOperation networkRequestThreadEntryPoint:
8 Foundation 0x306fedc7 0x30631000 + 843207
9 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
10 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
11 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 12:
0 libsystem_kernel.dylib 0x3a8fea84 0x3a8fe000 + 2692
1 CoreFoundation 0x2fce5561 0x2fc46000 + 652641
2 CoreFoundation 0x2fce3c81 0x2fc46000 + 646273
3 CoreFoundation 0x2fc4e541 0x2fc46000 + 34113
4 CoreFoundation 0x2fc4e323 0x2fc46000 + 33571
5 WebCore 0x37e56877 0x37d4d000 + 1087607
6 JavaScriptCore 0x30c6fa73 0x30c61000 + 60019
7 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
8 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
9 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 13:
0 libsystem_kernel.dylib 0x3a8fead4 0x3a8fe000 + 2772
1 MediaToolbox 0x3113fd0f 0x3113b000 + 19727
2 CoreMedia 0x3027a23f 0x30255000 + 152127
3 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
4 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
5 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 14:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 15:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 16 Crashed:
0 libsystem_platform.dylib 0x3a971656 0x3a970000 + 5718
1 CFNetwork 0x2f910f97 0x2f8dc000 + 216983
2 CFNetwork 0x2f910cc3 0x2f8dc000 + 216259
3 CFNetwork 0x2f9b4a5d 0x2f8dc000 + 887389
4 CFNetwork 0x2f910c13 0x2f8dc000 + 216083
5 CFNetwork 0x2f910b83 0x2f8dc000 + 215939
6 CoreFoundation 0x2fc62f2b 0x2fc46000 + 118571
7 myapp 0x00208c7b -SRWebSocket _pumpWriting
8 myapp 0x002075e3 -SRWebSocket _writeData:
9 myapp 0x0020a2c3 -SRWebSocket _sendFrameWithOpcode:data:
10 libdispatch.dylib 0x3a846103 0x3a845000 + 4355
11 libdispatch.dylib 0x3a84ae77 0x3a845000 + 24183
12 libdispatch.dylib 0x3a847f9b 0x3a845000 + 12187
13 libdispatch.dylib 0x3a84b751 0x3a845000 + 26449
14 libdispatch.dylib 0x3a84b9d1 0x3a845000 + 27089
15 libsystem_pthread.dylib 0x3a975dff 0x3a975000 + 3583
16 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 17:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 18:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 19:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 20:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 21:
0 libsystem_kernel.dylib 0x3a911c7c 0x3a8fe000 + 81020
1 libsystem_pthread.dylib 0x3a975cc4 0x3a975000 + 3268

Thread 22:
0 Foundation 0x307584c0 0x30631000 + 1209536
1 Foundation 0x306fedc7 0x30631000 + 843207
2 libsystem_pthread.dylib 0x3a977c5d 0x3a975000 + 11357
3 libsystem_pthread.dylib 0x3a977bcf 0x3a975000 + 11215
4 libsystem_pthread.dylib 0x3a975cd0 0x3a975000 + 3280

Thread 16 crashed with ARM Thread State:
pc: 0x3a971656 r7: 0x0941dc98 sp: 0x0941dc74 r0: 0x0000000c
r1: 0x00000001 r2: 0x00000001 r3: 0x00000016 r4: 0x16f7dd28
r5: 0x00000000 r6: 0x00000009 r8: 0x00000000 r9: 0x00000001
r10: 0x0941dd5c r11: 0x3aab0d80 ip: 0x3aaf37c4 lr: 0x2fcb81a3
cpsr: 0x20000030

@thorfei
Copy link

thorfei commented Mar 24, 2016

I met the same problem,here is the error stack

2016-03-24 7 12 53

@linjianxiong
Copy link

I have the same problem
Crashed Stack

Thread : Crashed: Thread
0 libsystem_platform.dylib 0x19a0f4c10 OSSpinLockLock + 4
1 CoreFoundation 0x18d407cc4 CFSocketDisableCallBacks + 84
2 CFNetwork 0x18cfc86c8 SocketStream::write(CoreWriteStream, unsigned char const, long, CFStreamError_) + 828
3 CFNetwork 0x18cfc8284 CoreStreamBase::streamInterface_Write(unsigned char const, long) + 160
4 CFNetwork 0x18cfc81a0 CoreWriteStreamCFStreamSupport::stream_write(CFWriteStream, unsigned char const, long, CFStreamError, void_) + 44
5 CoreFoundation 0x18d39a4cc CFWriteStreamWrite + 444
6 myApp 0x1009010f0 -SRWebSocket _pumpWriting
7 myApp 0x1008ff8c8 -SRWebSocket _writeData:
8 myApp 0x1009027d4 -SRWebSocket _sendFrameWithOpcode:data:
9 libdispatch.dylib 0x199f64014 _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x199f63fd4 _dispatch_client_callout + 16
11 libdispatch.dylib 0x199f6a4a8 _dispatch_queue_drain + 640
12 libdispatch.dylib 0x199f664c0 _dispatch_queue_invoke + 68
13 libdispatch.dylib 0x199f6b0f4 _dispatch_root_queue_drain + 104
14 libdispatch.dylib 0x199f6b4fc _dispatch_worker_thread2 + 76
15 libsystem_pthread.dylib 0x19a0f96bc _pthread_wqthread + 356
16 libsystem_pthread.dylib 0x19a0f954c start_wqthread + 4

@nlutsenko
Copy link
Contributor

Hey guys,

Taking into account that there are few people experiencing this crash - would there be any chance that you could provide a repro for this, so we can debug it first hand. Nothing immediately stands out here, and it looks like it's crashing somewhere inside CFNetwork callstack.

@zhgw01
Copy link

zhgw01 commented May 19, 2016

I met the same problem which happens on IOS7

2016-05-19 3 13 31

@linjianxiong
Copy link

From the crashlytics log to see only iOS7 crash

@nlutsenko
Copy link
Contributor

Hey guys, if you are able to get a consistent repro - I would love to investigate further.
Looks like we are failing specifically on handling ping/pong with the server.
I am curious whether it might be failing when a server sends empty ping data?
@zhgw01, since it looks like you can confirm the crash locally - can you inspect the data in the handlePing: frame of the stack trace?

@zhgw01
Copy link

zhgw01 commented May 20, 2016

I will try to, I just get the crash randomly, and cannot reproduce it consistently. I try to reproduce it and inspect the the data

@thorfei
Copy link

thorfei commented May 20, 2016

ping data is empty,
2016-05-20 11 46 17
2016-05-20 11 46 12

@nlutsenko
Copy link
Contributor

Aha! That's probably where our issue is coming from.
What happens if you do something like

pingData = pingData ?: [NSData data];

in this method before calling sendFrameWithOpcode:data:

@thorfei
Copy link

thorfei commented May 20, 2016

Hi, @nlutsenko
How to explain this issue, are you sure it is caused by pingData is empty. I think it may happens not only on ios7.

@nlutsenko
Copy link
Contributor

@CodeFei, nope, not sure.
Since this fails specifically on the stack trace after receiving ping and all the stack traces reported before match - the first thing that I would check is whether this is related to ping or not.
Nothing stands out to me so far, since I believe we are handling nil data gracefully, even in case if ping data there is empty.

The current master is using completely different way of getting data (not NSData, but dispatch_data_t) so this might be already fixed and no longer relevant, since we are accessing the data and sending it to write completely in a different way now.

@zhgw01 @CodeFei, since it looks like you guys have this reproduced at least a few times locally, could you try running with the current latest master and comment here if you run into this crash again.

@thorfei
Copy link

thorfei commented May 22, 2016

@nlutsenko
Thanks for your reply, I will keep tracking problem in my app. This crash actually is difficult to reproduced.
I checked my code, and found somewhere I may wrote wrong code. When socket connect failed, I will keep retry connect at not main thread.
I will modify my code and reconnect socket at main thread, If I found this crash error again, I will use the latest master.

@thorfei
Copy link

thorfei commented Jun 7, 2016

@nlutsenko
When the new version will be released?

@nlutsenko
Copy link
Contributor

@CodeFei, as soon as we stabilize master and make sure that we don't have random crashes (as you've reported) - I am going to cut a new version.

@nlutsenko nlutsenko self-assigned this Jun 21, 2016
@nlutsenko
Copy link
Contributor

Going to close this one out, as it looks this is finally fixed.
Let me know if you can still reproduce it on the current state of master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants