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

EXC_BAD_ACCESS (SIGSEGV),Help! #590

Open
qixin1106 opened this issue May 14, 2021 · 0 comments
Open

EXC_BAD_ACCESS (SIGSEGV),Help! #590

qixin1106 opened this issue May 14, 2021 · 0 comments

Comments

@qixin1106
Copy link

Device Info

pod 'MQTTClient', '~> 0.15.3'
Xcode Version 12.5 (12E262)
MacOS 11.3 (20E232)

Crash Info

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000003d290848018
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [11573]

-[MQTTSSLSecurityPolicyEncoder stream:handleEvent:] (in XiaoP) (MQTTSSLSecurityPolicyEncoder.m:58)
-[MQTTDecoder close] (in XiaoP) (MQTTDecoder.m:87)
-[MQTTDecoder dealloc] (in XiaoP) (MQTTDecoder.m:31)
-[MQTTSession connect] (in XiaoP) (MQTTSession.m:1547)
-[XYMQTTManager _connectAndResetRetryInterval:] (in XiaoP) (XYMQTTManager.m:565)
__22-[XYMQTTManager start]_block_invoke (in XiaoP) (XYMQTTManager.m:163)
-[ReconnectTimer reconnect] (in XiaoP) (ReconnectTimer.m:64)

I found that there is a corresponding fix in MQTTDecoder,But there is no such fix in MQTTCFSocketDecoder and MQTTCFSocketEncoder

MQTTDecoder.m

- (void)stream:(NSStream *)sender handleEvent:(NSStreamEvent)eventCode {
    // We contact our delegate, MQTTSession at some point in this method
    // This call can cause MQTTSession to dealloc and thus, MQTTDecoder to dealloc
    // So we end up with invalid object in the middle of the method
    // To prevent this we retain self for duration of this method call
    MQTTDecoder *strongDecoder = self;
    (void)strongDecoder;
    .....
}
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

1 participant