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

Crash... #89

Closed
aviz opened this issue Jun 1, 2015 · 8 comments
Closed

Crash... #89

aviz opened this issue Jun 1, 2015 · 8 comments

Comments

@aviz
Copy link

aviz commented Jun 1, 2015

The following code crashes in Websocket.swift, line 500

            var len = dataLength
            if dataLength > UInt64(bufferLen) {
                len = UInt64(bufferLen-offset)
            }

value of dataLength is 256
value of offset is 4
value of buffer len is 3

the new len will be -1 which gives an error due to Uint64 conversion.

@daltoniam
Copy link
Owner

This is the same as #52 and #72. I might be related to #77 as well. I need a little more info to be able to track it down. Does this happen on every device type? What are the conditions to reproduce the behavior?

@aviz
Copy link
Author

aviz commented Jun 1, 2015

I don't have too much info... it happens sporadicly on the same device.. about 1 out of 20 connections.

I am using nginx + golang gorilla + golang gin as the backend.

@daltoniam
Copy link
Owner

Alright. Next time it happens try grabbing your stack trace. Would help in debugging the problem.

@aviz
Copy link
Author

aviz commented Jun 11, 2015

I think this happens when calling connect() method from websocketDidDisconnect ...
my guess is that connect dose not initialize the variables which makes this crash possible,

@daltoniam
Copy link
Owner

Alright, I can say with some confidence that it isn't the connect() call in the websocketDidDisconnect as I have called it many times in that configuration and it works fine. I would lean toward a race condition causing the issue. I would make sure the call to connect happen on the same thread the webSocket object was created. I have been kicking around adding protection to help prevent the possible race conditions.

@edementiev
Copy link

I have checked. The connect() method and creation of WebSocket objects are created in the same thread, but i have the same problem. May be something is wrong in another place?
Also it's have been only in release build, in the developers build it's working correctly

@daltoniam
Copy link
Owner

ok good to know. Only being a release build makes me think it might be something like #77. I might merge this issue with that one, since they seem related.

@daltoniam
Copy link
Owner

Merging with #77.

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

3 participants