Trouble with Websocket extension (SOLVED)

Hi everyone! See it when trying to connect to colyseus server, only when run apk on device (catched in Android Studio). Not sure that the problem is in Websocket, but I suspect that.

A/libc: ../src/dlib/thread.cpp:40: void dmThread::ThreadStartProxy(void *): assertion "ret == 0" failed
I/defold: INFO:CRASH: Successfully wrote Crashdump to file: /data/user/0/com.inkgroup.royaldice/files/_crash
E/defold: ERROR:CRASH: CALL STACK:
    
    # 0 pc        0x638 [vdso] <unknown>+0
    # 1 pc      0x422a4 ...oid.runtime/lib64/bionic/libc.so <unknown>+0

Can someone help?

2 Likes

Thanks for the report!
I think @britzl is very interested in this. We recently (yesterday) released a new version that should avoid triggering ANR’s on Android. We do so by introducing a thread.

Is this crash 100% reproducible?
Do you perhaps have a small project we can use to debug this? Or, what are the steps required to reproduce the bug?
Are you using a single websocket, or multiple ones?
What device are you using?

Thanx for reply.

Crash is 100% reproducible.
Creating small project will take a time, but I can do it if needed.
I actuallty dont know about single/multiple, how to check it?

I’m using Samsung Galaxy S10

I’ll try to write down steps which are causing the problem now

I actuallty dont know about single/multiple, how to check it?

How many websocket.connect()calls do you make?

Yes, please share more information!

I dont call websocket directly, I’m working with Colyseus, and Colyseus is using Websocket extention, as far as I know (at least it requires to add websocket dependency in game.project).

Now I have inserted some prints)

And I see thah self.client = Colyseus.new("ws://5.101.116.56:2567") is working OK.
The next is self.client:join_or_create(roomName, options, callback). Both prints before and after this line are calls, but when I remove this line from code, there is no crash. So it seems that the problem is about callback. I also see that callback is not calling, even with error

1 Like

And as far as I can see from Colyseus Defold module source, it uses http.request for join_or_create, not websocket. But I can be wrong

Checked on another devices (Samsung tablet and Honor 10 lite), same story

I tried to remove websocket dependency from game.project and test apk. Crash remains. It seems websocket has nothing to do with it

colyseus test.zip (64.8 KB)

here is small project

Thank you. I’m going to investigate this. One recommendation I have is to not always depend on the latest version of the extension. In your dependencies list you currently have:

https://github.com/defold/extension-websocket/archive/master.zip

It is recommended to depend on a specific version. This is the previous version which I suggest you revert to for now:

https://github.com/defold/extension-websocket/archive/2.2.0.zip

All releases: https://github.com/defold/extension-websocket/releases

I have a PR prepared for review by @JCash here:

2 Likes

Merged and released:

Thank you for reporting!

3 Likes

Wow, glad to see it, thank you! I’ll check it tomorrow and let you know here

1 Like

Evething is perfect, thank you very much :slight_smile:

1 Like