talk-android icon indicating copy to clipboard operation
talk-android copied to clipboard

Error while leaving room: I/O error during system call, Broken pipe / websocket closed with status 1005

Open mahibi opened this issue 4 years ago • 6 comments

leaving the room probably fails because of WebSocket failures. this will explain multiple bugs.

Steps to reproduce

  1. Leaving the chatview might trigger to leave the room under certain circumstances:
        if (conversationUser != null &&
            activity != null &&
            !activity?.isChangingConfigurations!! &&
            !ApplicationWideCurrentRoomHolder.getInstance().isInCall &&
            !ApplicationWideCurrentRoomHolder.getInstance().isDialing
        ) {
            ApplicationWideCurrentRoomHolder.getInstance().clear()
            wasDetached = true
            leaveRoom()
        }

see https://github.com/nextcloud/talk-android/blob/master/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt#L1595

For example:

  • accept a call from notification while being in a chat

Expected behaviour

no errors & successful call connection

Actual behaviour

the following error occurs. afterwards establishing the call connection fails.

2021-11-23 21:46:42.967 11840-11840/com.nextcloud.talk2 D/ChatController: onDetach
2021-11-23 21:46:42.967 11840-11840/com.nextcloud.talk2 D/ChatController: leaveRoom
2021-11-23 21:46:43.370 11840-11840/com.nextcloud.talk2 D/MagicWebSocketInstance: joinRoomWithRoomTokenAndSession
2021-11-23 21:46:43.370 11840-11840/com.nextcloud.talk2 D/MagicWebSocketInstance:    roomToken: 
2021-11-23 21:46:43.371 11840-11840/com.nextcloud.talk2 D/MagicWebSocketInstance:    session: lfQwa1LGbFu4XOfp4+kcu4FNlN6TwG09PWM2Smo/XcH9KXgNTQ+e8Hvfmja8kDzr/KrRt9PTxI+HoZMlLzjBsunNt6/uJNN2NsihfVLW2bXDSlTQGi0sfU4A9NwQEmIGSf2ye2klquB9mIAMqxmeah0LG2wq+lqs7VVbAeBH1HAlk+cIKA3vkDqubKD86ecEgXU4XLYxnNllmNInnQ2BY0IV8OLzwVeJEhRFWUGz0F5woF+4mxOlGKqv4bmYjGS
2021-11-23 21:46:43.378 11840-12210/com.nextcloud.talk2 D/MagicWebSocketInstance: Error : WebSocket 233878393 onFailure: Write error: ssl=0x759689c088: I/O error during system call, Broken pipe
2021-11-23 21:46:43.379 11840-12210/com.nextcloud.talk2 D/MagicWebSocketInstance: restartWebSocket: wss://sermo.nextcloud.com/standalone-signaling/spreed
2021-11-23 21:46:43.840 11840-12344/com.nextcloud.talk2 D/MagicWebSocketInstance: Receiving : okhttp3.internal.ws.RealWebSocket@f93fa0 {"type":"error","error":{"code":"no_such_session","message":"The session to resume does not exist."}}
2021-11-23 21:46:43.842 11840-12344/com.nextcloud.talk2 E/MagicWebSocketInstance: Received error: {"type":"error","error":{"code":"no_such_session","message":"The session to resume does not exist."}}
2021-11-23 21:46:43.845 11840-12344/com.nextcloud.talk2 D/MagicWebSocketInstance: WebSocket 16334752 resumeID MTYzNzcwMDE2OHwzR0NKUEdVcTh6dTdWblk4Y056enM5X3ZlaWlDeWZCVlIxRVphaWd5bHp1UEh2X2V1QzJvdDAxcVo1cWRWYTVZTm9WM241dVppakRZSXcwbk1TRVExbGRMWDAzdFVybVZ4Ry0tUXYzTHk3N0lWU2tHYzI2ZHBVU05SejVKQlE2NHpLTlRSbXQxc2RfTW54QXBBWTNZYkJ4YmZObFFIRmNicV9CU2t2UG5menJJfLTR2jWALktviQAps3imPS90squWJMuYWxq0VmhRhCYy expired
2021-11-23 21:46:43.846 11840-12344/com.nextcloud.talk2 D/MagicWebSocketInstance: restartWebSocket: wss://sermo.nextcloud.com/standalone-signaling/spreed
2021-11-23 21:46:45.062 11840-12346/com.nextcloud.talk2 D/MagicWebSocketInstance: Receiving : okhttp3.internal.ws.RealWebSocket@b42b5cc {"type":"hello","hello":{"version":"1.0","sessionid":"pGJpwmT2hxGNCkPJ55_jLNzArqT7Zkd8FaiskahExFp8cWRiTURBNE52cXlvekFBN2hGQUs5LXU4NTFOM1BmTFZKX3RuUXhZbXhDZWJNbkJZbmlVc0twWENjdGZyaDRIT2l2UVgzVlZTTjc4SjhDMTRnYk1icURaWDNWT3RCa2hvaDhQX1QtZUlBVmg2cHB4eEE2Zm1EcGNGc0NxUWczVlNjYXRfR0N4ajlodW1SY09RczkxS0FUeHRjWmdTZThob1c4RnJvSnJQMDlLa3w2MDQwMDc3MzYx","resumeid":"MTYzNzcwMDQwNnxlOGRnLTBiVlY3QWVRck42WE0wUWV2MVdnWTVjRUlsczZCRTlna1ZEZHVXX01hTUlXNDkyd0pubGZlNjdfcVlpZ2wtcmg0QmlNNDNQOGszSkNST1hOZXZUY050Z1RWNVRzMExUdzJ5TnVWMVF3eTlmQzk4ZE9PTWk4Rjh4aHg4ZEpxcEE1MzUwbjA0YzlvMzd0aTExeTBycW4zeGJUM0NQWFh0dmR1U2hPNWF5fIkH7fFipCtMvKfiBfFqRYQLRuxPEfrnlS6qwCjvcGV3","userid":"marcel2","server":{"version":"0.4.0-1~ubuntu20.04","features":["audio-video-permissions","mcu","simulcast"]}}}
2021-11-23 21:46:46.192 11840-12185/com.nextcloud.talk2 D/MagicFirebaseMessagingService: getPeersForCall onComplete
2021-11-23 21:46:46.556 11840-12344/com.nextcloud.talk2 D/MagicWebSocketInstance: Closing : 1005 / 

mahibi avatar Nov 23 '21 21:11 mahibi

for "The session to resume does not exist." see https://github.com/strukturag/nextcloud-spreed-signaling/blob/master/hub.go#L55

mahibi avatar Nov 23 '21 21:11 mahibi

maybe the session string is not fully transferred because of some limits: https://stackoverflow.com/questions/38016109/javax-net-ssl-sslexception-write-error-ssl-0x7f70604080-i-o-error-during-syst 🤷‍♂️

mahibi avatar Nov 23 '21 21:11 mahibi

sometimes when leaving the room there is only MagicWebSocketInstance: Closing : 1005 / without the I/O error during system call, Broken pipe error beforehand.

But it has the same effect, so afterwards the call connection fails..

2021-11-24 07:32:47.952 3637-3637/com.nextcloud.talk2 D/ChatController: onDetach
2021-11-24 07:32:47.953 3637-3637/com.nextcloud.talk2 D/ChatController: leaveRoom
2021-11-24 07:32:48.617 3637-3945/com.nextcloud.talk2 D/MagicWebSocketInstance: Receiving : okhttp3.internal.ws.RealWebSocket@df0b379 {"type":"event","event":{"target":"roomlist","type":"disinvite","disinvite":{"reason":"disinvited","roomid":"3853979093"}}}
2021-11-24 07:32:48.645 3637-3945/com.nextcloud.talk2 D/MagicWebSocketInstance: Closing : 1005 / 
2021-11-24 07:32:48.892 3637-3637/com.nextcloud.talk2 D/MagicWebSocketInstance: joinRoomWithRoomTokenAndSession
2021-11-24 07:32:48.892 3637-3637/com.nextcloud.talk2 D/MagicWebSocketInstance:    roomToken: 
2021-11-24 07:32:48.892 3637-3637/com.nextcloud.talk2 D/MagicWebSocketInstance:    session: Cup4vD/RnX1tVoK9LvC/Ud2D7Qn3YyrbuBMrP3MkvvUE3UPoEsqCcYEZt+IuDfzlEmPm0C+6eYh6lvEVw+Tzi0idb5pIUTraIfD7n3D1W1dCTUZI5eyRNUrR1cZCbbm5xeioGFYlEEB1geIwjMBNh7cQwL8Av8beBZyb+zEYu5wciaFbie8603LtBEorbzzz5HO+zBavL5MDkL4D6nm6aaTAnyXAGHcs4XVTXEq5xhHsMRqNipkKsAlOxCzEPGN

mahibi avatar Nov 24 '21 06:11 mahibi

this error also perfectly explains https://github.com/nextcloud/talk-android/issues/1712

mahibi avatar Nov 24 '21 07:11 mahibi

Talked a bit with @Ivansss and apparently it is expected that the websocket is opened immediately. But iOS only does it for the active profile, not for all

nickvergessen avatar Nov 25 '21 10:11 nickvergessen

Is this the same problem? https://github.com/nextcloud/talk-android/issues/1633

jakobroehrl avatar Dec 16 '21 09:12 jakobroehrl