req in websocket prematurely freed?

9 views
Skip to first unread message

Basile Starynkevitch

unread,
Jan 13, 2015, 9:58:22 AM1/13/15
to onio...@coralbits.com
Hello all,

My application (which BTW uses the Boehm garbage collector) keeps a global onion_websocket*websocket; pointer. That pointer is protected by a global mutex.

It looks like the req field inside that websocket global gets prematurely freed indirectly by onion_listen e.g.

(gdb) bt
#0  0x00007ffff78bc9a2 in GC_free () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#1  0x00007ffff7487723 in onion_request_free (req=0x6dd720)
    at /usr/src/Libs/onion-basile/src/onion/request.c:144
#2  0x00007ffff7490ac3 in onion_poller_slot_free (el=0x6ed0a0)
    at /usr/src/Libs/onion-basile/src/onion/poller.c:125
#3  0x00007ffff7490f44 in onion_poller_remove (poller=poller@entry=0x6ed2d0,
    fd=14) at /usr/src/Libs/onion-basile/src/onion/poller.c:310
#4  0x00007ffff749115b in onion_poller_poll (p=0x6ed2d0)
    at /usr/src/Libs/onion-basile/src/onion/poller.c:452
#5  0x00007ffff7484e76 in onion_listen (o=0x6e2e60)
    at /usr/src/Libs/onion-basile/src/onion/onion.c:501
#6  0x0000000000426a7b in run_onion_ya () at cyaca.c:7354
#7  0x000000000042d7e3 in main (argc=2, argv=0x7fffffffe6a8) at cyaca.c:8417

Is there a way to be notified when that websocket is no more polled and its req field is freed?

Cheers & Happy New Year.

--
Basile Starynkevitch    http://starynkevitch.net/Basile/

David Moreno Montero

unread,
Jan 13, 2015, 10:02:37 AM1/13/15
to Basile Starynkevitch, onion-dev
I think you can use the websocket user data free function (set at onion_websocket_set_userdata), which should be called when the websocket gets closed.

--
You received this message because you are subscribed to the Google Groups "onion-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onion-dev+...@coralbits.com.
To post to this group, send email to onio...@coralbits.com.
Visit this group at http://groups.google.com/a/coralbits.com/group/onion-dev/.
For more options, visit https://groups.google.com/a/coralbits.com/d/optout.



--

Basile Starynkevitch

unread,
Jan 13, 2015, 10:12:23 AM1/13/15
to onio...@coralbits.com

Is there a way to be notified when that websocket is no more polled and its req field is freed?

I forgot to say that my application does not read anything on the websocket, only writes to it.

Apparently, the onion_websocket_free is calling its callback with a special length of -1, so I should use that.
 
Reply all
Reply to author
Forward
0 new messages