uNetworking / uSockets

Miniscule cross-platform eventing, networking & crypto for async applications
Apache License 2.0
1.29k stars 267 forks source link

Weird error when using ARM64 arch #193

Closed HagaiVinik closed 1 year ago

HagaiVinik commented 1 year ago

Hey, I'm facing a very weird issue that happens only when I run my application on arm architecture, it didn't happen on x86, so I though it's worth asking here maybe I'm doing something wrong.

I have developed some kind of a proxy server, I use uWebSocket for server and uSocket for client, and I'm doing the following steps:

This whole flow was working well on my machine, but when I tested it on an ARM64 machine, the app crashed with a segmentation fault on this line:

socket.c

int written = bsd_send(us_poll_fd(&s->p), data, length, msg_more);
    if (written != length) {
        s->context->loop->data.last_write_failed = 1;      //Failed here, I assume this flag change triggered some issue..?
        us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
    }

Probably this issue has to do with something else I'm doing wrong, but I would appreciate any kind of help I can get :raised_hands: Thanks in advance!

HagaiVinik commented 1 year ago

Alright never mind found the issue... It was kind of a race condition between two modules that one ran out of scope. :disappointed: and for some reason I didn't encounter this issue on X86.

Thanks anyway and sorry for bothering.