[Libwebsockets] Mbedtls handshake fails often (on windows)

Lasa Martxel mlasa at ikerlan.es
Wed Feb 6 08:40:10 CET 2019


Morning,

I'm having an issue with libwebsockets.

I have built libwebsockets with mbedtls support on windows. I have created a simple example that responds GET requests, both http and https.

With HTTP requests, I don't have issues so far. When I use HTTPS however I get an error in the TLS negotiation every 4-5 requests.

If I wait a few seconds between requests, I don't get the error that often.

I have tried with the minimal tls example, and it happens the same thing:

[2019/02/06 07:36:47:6576] DEBUG: accepted new conn port 59567 on fd=824
[2019/02/06 07:36:47:6576] DEBUG: _realloc: size 368: new server wsi
[2019/02/06 07:36:47:6595] DEBUG: new wsi 0302E900 joining vhost localhost, tsi 0
[2019/02/06 07:36:47:6595] INFO: lws_vhost_bind_wsi: vh localhost: count_bound_wsi 2
[2019/02/06 07:36:47:6595] DEBUG: lwsi_set_state(0302E900, 0x200)
[2019/02/06 07:36:47:6595] DEBUG: lws_role_transition: 0302E900: wsistate 0x20000207, ops h1
[2019/02/06 07:36:47:6605] DEBUG: __lws_set_timeout: 0302E900: 20 secs (reason 3)
[2019/02/06 07:36:47:6605] DEBUG: new wsi wsistate 0x20000207
[2019/02/06 07:36:47:6615] DEBUG: lwsi_set_state(0302E900, 0x20000208)
[2019/02/06 07:36:47:6615] DEBUG: __insert_wsi_socket_into_fds: 0302E900: tsi=0, sock=824, pos-in-fds=2
[2019/02/06 07:36:47:6615] DEBUG: __lws_set_timeout: 0302E900: 20 secs (reason 9)
[2019/02/06 07:36:47:6615] DEBUG: inserted SSL accept into fds, trying SSL_accept
[2019/02/06 07:36:47:6615] DEBUG: _lws_change_pollfd: wsi 0302E900: fd 824 events 9 -> 9
[2019/02/06 07:36:47:6615] INFO: mbedtls_handshake: ssl ret -0 state 1
[2019/02/06 07:36:47:6624] NOTICE: lws_mbedtls_sni_cb: localhost
[2019/02/06 07:36:47:6624] INFO: SNI: Found: localhost
[2019/02/06 07:36:47:6624] INFO: SNI: Found: localhost:4443 at vhost 'localhost'
[2019/02/06 07:36:47:6624] INFO: mbedtls_handshake: ssl ret -0 state 2
[2019/02/06 07:36:47:6624] INFO: mbedtls_handshake: ssl ret -0 state 3
[2019/02/06 07:36:47:6634] INFO: mbedtls_handshake: ssl ret -0 state 4
[2019/02/06 07:36:47:7727] INFO: mbedtls_handshake: ssl ret -0 state 5
[2019/02/06 07:36:47:7727] INFO: mbedtls_handshake: ssl ret -0 state 6
[2019/02/06 07:36:47:7747] INFO: mbedtls_handshake: ssl ret -0 state 7
[2019/02/06 07:36:47:7747] INFO: mbedtls_handshake: ssl ret -0 state 8
[2019/02/06 07:36:47:7747] INFO: mbedtls_handshake: ssl ret -6900 state 8
[2019/02/06 07:36:47:7747] DEBUG: lws_tls_server_accept: 0302E900: accept SSL_get_error 5 errno 0
[2019/02/06 07:36:47:7747] INFO: SSL_accept says -1
[2019/02/06 07:36:47:7747] INFO: SSL_accept failed socket 824: -1
[2019/02/06 07:36:47:7747] INFO: lws_adopt_descriptor_vhost: fail ssl negotiation
[2019/02/06 07:36:47:7757] INFO: __lws_close_free_wsi: 0302E900: caller: adopt skt fail
[2019/02/06 07:36:47:7757] DEBUG: __lws_close_free_wsi: real just_kill_connection: 0302E900 (sockfd 824)

When I build and run it on linux, there are no problems.

Any clues?

Thanks,

Martxel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190206/4bc4d6ab/attachment.html>


More information about the Libwebsockets mailing list