After testing the echotest and videocall programs running on three machines I have noticed that if the session is not destroyed by the Janus Server then any new create session id's are not processed. Viewing tcptracks or netstat will show that the server is receiving a lot of tcp syn_send packets and never receives the new session create request. A restart of the server is the only way I have found to sync the server to accept new session id request.
In my test when the app ajax POST destroy message fails to be delivered it triggers the server to be out of sync with tcp request.
No WebRTC media anymore
[1680855497] ICE send thread leaving...
Detaching handle from JANUS EchoTest plugin
Handle detached (0), scheduling destruction
[1680855497] Destroying SCTP association
[1680855497] WebRTC resources freed
[1680855497] Handle and related resources freed
[1680855497] Leaving SCTP association thread
No WebRTC media anymore
[234741942] ICE send thread leaving...
[234741942] Destroying SCTP association
[234741942] WebRTC resources freed
[234741942] Leaving SCTP association thread
Creating new session: 1162020257
Detaching handle from JANUS EchoTest plugin
Handle detached (0), scheduling destruction
Server state when the POST destroy request succeeds
[WARN] [286935095] Unsupported transport tcp!
[286935095] The DTLS handshake has been completed
WebRTC media is now available
[286935095] Starting thread for SCTP association
[286935095] Started thread: setup of the SCTP association
[ERR] [sctp.c:janus_sctp_association_setup:264:] [286935095] Error connecting to SCTP server at port 5000
No WebRTC media anymore
[286935095] ICE send thread leaving...
Detaching handle from JANUS EchoTest plugin
Handle detached (0), scheduling destruction
[286935095] Destroying SCTP association
[286935095] WebRTC resources freed
[286935095] Handle and related resources freed
[286935095] Leaving SCTP association thre
When running the test on my nexus tablet connected to a wireless network the POST destroy call fails sometimes and the server does not destroy the session id. Subsequent connection tries fail with is the server down message. In some cases the chrome browser becomes unresponsive.
$.ajax({
type: 'POST',
url: server + "/" + sessionId,
async: syncRequest, // Sometimes we need false here, or destroying in onbeforeunload won't work
cache: false,
contentType: "application/json",
data: JSON.stringify(request),
success: function(json) {
Janus.log("Destroyed session:");
Janus.log(json);
sessionId = null;
connected = false;
if(json["janus"] !== "success") {
Janus.log("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
}
callbacks.success();
gatewayCallbacks.destroyed();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
Janus.log(textStatus + ": " + errorThrown); // FIXME
// Reset everything anyway
sessionId = null;
connected = false;
callbacks.success();
gatewayCallbacks.destroyed();
},
dataType: "json"
});
}