[noPoll] Deadlock
Francis Brosnan Blázquez
francis.brosnan en aspl.es
Vie Mar 4 10:28:42 CET 2016
Hi Ondrej,
Thanks for reporting. I haven't had time to review it and let you know,
I'll keep you updated about this,
Best Regards,
> Hi,
>
> I am using the function nopoll_thread_handlers to make the library thread safe
>
> ************************************
> noPollPtr WebSocket::mutexCreate(void)
> {
> std::mutex * mutex = new std::mutex;
> std::cout<<".................create"<<std::endl;
> return static_cast<noPollPtr>(mutex);
> }
>
> void WebSocket::mutexDestroy(noPollPtr _mutex)
> {
> std::cout<<".................destroy"<<std::endl;
> std::mutex * mutex = static_cast<std::mutex *>(_mutex);
> delete mutex;
> }
>
> void WebSocket::mutexLock(noPollPtr _mutex)
> {
> std::cout<<".................lock"<<std::endl;
> std::mutex * mutex = static_cast<std::mutex *>(_mutex);
> mutex->lock();
> }
>
> void WebSocket::mutexUnlock(noPollPtr _mutex)
> {
> std::cout<<".................unlock"<<std::endl;
> std::mutex * mutex = static_cast<std::mutex *>(_mutex);
> mutex->unlock();
> }
>
> nopoll_thread_handlers(&WebSocket::mutexCreate,
> &WebSocket::mutexDestroy, &WebSocket::mutexLock,
> &WebSocket::mutexUnlock);
>
> ***********************************
>
> When the socket closes (timeout on TCP socket) the library dead-locks
> DEBUG PRINT:
>
> ***********************************
> (proc 9668): (debug)nopoll_conn.c:3008 nopoll_conn_send_text:
> Attempting to send 16 bytes
>
> (proc 9668): (debug)nopoll_conn.c:3691 Copying into the buffer 6 bytes
> of header (total memory allocated: 23)
>
> (proc 9668): (debug)nopoll_conn.c:3705 Mask used for this delivery:
> -604747364 (about to send 22 bytes)
>
> (proc 9668): (debug)nopoll_conn.c:3743 Bytes written to the wire 22
> (masked? 1, mask: 1133566964, header size: 6, length: 16)
>
> (proc 9668): (debug)nopoll_conn.c:3781 Write operation finished with
> with last result=16, bytes_written=16, requested=16, remaining=0
> (conn-id=2)
>
> .................lock
>
> .................unlock
>
> .................lock
>
> .................unlock
>
> .................lock
>
> (proc 9668): (debug)nopoll_conn.c:2518 === START: conn-id=2 (errno=11,
> session: 6, conn->handshake_ok: 1, conn->pending_ssl_accept: 0) ===
>
> (proc 9668): (critical) nopoll_conn.c:1876 unable to readn=2, error
> code was: 110 (Connection timed out) (shutting down connection)
>
> (proc 9668): (debug)nopoll_conn.c:1436 shutting down connection id=2
> (session: 6, role: client)
>
> (proc 9668): (critical) nopoll_conn.c:2695 Received connection close,
> finishing connection session
>
> (proc 9668): (debug)nopoll_conn.c:1436 shutting down connection id=2
> (session: -1, role: client)
>
> .................unlock
>
> .................lock
>
> .................lock
> **************************************
>
> The problem happens because the function nopoll_ctx_foreach_conn locks
> the mutex and function nopoll_ctx_unregister_conn tries to lock the
> mutex again.
> _______________________________________________
> noPoll mailing list
> noPoll en lists.aspl.es
> http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll
--
Francis Brosnan Blázquez - ASPL
http://www.asplhosting.com/
http://www.aspl.es/
https://twitter.com/aspl_es
https://twitter.com/asplhosting
https://twitter.com/francisbrosnanb
91 134 14 22 - 91 134 14 45 - 91 116 07 57
AVISO LEGAL
En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de
diciembre, de Protección de Datos de Carácter Personal, le informamos de
que sus datos de carácter personal, recogidos de fuentes accesibles al
público o datos que usted nos ha facilitado previamente, proceden de
bases de datos propiedad de Advanced Software Production Line, S.L.
(ASPL).
ASPL garantiza que los datos serán tratados con la finalidad de mantener
las oportunas relaciones comerciales o promocionales con usted o la
entidad que usted representa. No obstante, usted puede ejercitar sus
derechos de acceso, rectificación, cancelación y oposición dispuestos en
la mencionada Ley Orgánica, notificándolo por escrito a ASPL -
Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de Henares
(Madrid).
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20160304/27abb9c1/attachment.html>
Más información sobre la lista de distribución noPoll