Noob: webrtc connectivity issue via localhost

396 views
Skip to first unread message

Rob Sherwood

unread,
Apr 6, 2020, 12:40:51 AM4/6/20
to kurento
  • Operating system --> Ubuntu 18.04
  • Installation method  --> media-server from apt-get, kurento-magic-mirror demo from  source
  • Kurento version --> debian package 6.13.0-0kurento1.18.04, kurento source from branch '6.13.0'
Just found the kurento project and am excited to try it out.  I'm trying to run basic kurento demos from https://doc-kurento.readthedocs.io/en/6.13.0/tutorials/java/tutorial-magicmirror.html,
have installed the default bionic/ubuntu 18.04 kurento-media-server, and downloaded the demo source from https://github.com/Kurento/kurento-tutorial-java.git.

As suggested in the demo all three of the media server, the kurento magic-mirror app and the web browser (chrome Version 79.0.3945.130 (Official Build) (64-bit)) are all running on the same machine.

However, when I load the "localhost:8443" webpage as suggested in the demo script (very well documented- thanks!), the page loads and when I click 'start' my local camera starts on the left window,
but right window/webrtc connection never starts.  I get identical results with other demos, so I don't think this is unique to the magic mirror demo.

Here's what I've done to debug so far (to no avail):

1) Walked through the steps in https://doc-kurento.readthedocs.io/en/latest/user/troubleshooting.html#webrtc-connection-is-not-established
    a) this is all via localhost, so no stun server should be needed - right?
    b) this device is technically behind a nat but even with a stun server configured, still no dice
    c) looking at the console output of the SDP I see a bunch of " 172.3.185.49 36340 typ srflx raddr 192.168.2.83" messages (172.3.185.49 is the public IP, 192.168.2.83 is the internal IP) so stun is working properly
2) The machine has dual interfaces wifi and wired.  Wired isn't connected so I changed WebRtcEndpoint.conf.ini networkInterfaces to the wifi and loopback addresses only; no dice
3) I tried 'strace -pf $(pgrep kurento)' but didn't see any connect attempts
4) I tried 'tcpdump -n -i any' to monitor traffic and I see connections to the stun server (still not needed :-() but no attempts to create new connections (UDP or TCP) back to the localhost.
5) I changed all of the kurento related logs in kurento-magic-mirror/src/main/resources/application.properties to DEBUG, but no obvious problem there.  In fact, no logs on loading the webpage.
6) Looking at the media server logs in /var/log/kurento-media-server/errors.log there's nothing other than the "new execution" logs when I change configs
7) Looking at the (more detailed?) log /var/log/kurento-media-server/2020-04-05T212940.00000.pid6103.log shows no logging when I try to load the page/create a connection.

In reading some of the docs, it seems like I should be able to put the media server is some sort of more verbose mode to get more detailed logs, but it's not clear how.

Any thoughts on what I could look at to figure out what's going wrong?

Thank you in advance and apologies if this is documented somewhere.  I did spend some time sorting through lots of options before mailing the list.

- Rob
.

Rob Sherwood

unread,
Apr 7, 2020, 11:39:32 AM4/7/20
to kurento
Perhaps someone can point me to what a valid/working console log for a demo looks like so I can try to diff the two?

Thanks in advance,

- Rob
.

Micael Gallego

unread,
Apr 7, 2020, 11:53:36 AM4/7/20
to kur...@googlegroups.com
Do you know OpenVidu (https://openvidu.io)?

Maybe it is easier to start with.

Best regards

Micael Gallego
Kurento / OpenVidu Project Lead


--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/918b8d56-877b-4b1e-aaed-0a7b11345171%40googlegroups.com.

Harry Cummings

unread,
Apr 8, 2020, 5:28:01 AM4/8/20
to kurento
Hi Rob,

I'm not sure if it will be useful to you, but I had a similar issue within the last few days using the same versions and following the same tutorials. I found that Firefox running on the same machine worked, but Chrome silently failed, and both Chrome and Fx on a second machine (within the same network) failed.

I enabled debug logging on the Java application server (not the KMS) and spotted an error that led me to this SO post: https://stackoverflow.com/questions/21730566/how-to-increase-output-buffer-for-spring-sockjs-websocket-server-implementation

Adding the following to my main Application class (named HelloWorldApp in the example you're running) resolved all three of the failing cases above:

@Bean
public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() {
ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
container.setMaxTextMessageBufferSize(32768);
return container;
}

I found a similar change was necessary to get the other Java example applications running (specifically: I ran kurento-group-call and kurento-one2many-call, which both seemed to need the above change). Let me know whether this also helps you. If it does, then I can raise a PR to update all the Java examples.

Cheers,
Harry

Rob Sherwood

unread,
Apr 10, 2020, 1:52:20 AM4/10/20
to kur...@googlegroups.com
Hi Harry - thanks for the great reply!

I am indeed (once I enable the right debug options) seeing that same error:

2020-04-09 22:37:32.547 DEBUG 5008 --- [nio-8443-exec-2] o.a.t.websocket.server.WsFrameServer     : Read [1642] bytes into input buffer ready for processing
2020-04-09 22:37:32.547 DEBUG 5008 --- [nio-8443-exec-2] o.a.t.websocket.server.WsFrameServer     : WebSocket frame received. fin [true], rsv [4], OpCode [1], payload length [126]
2020-04-09 22:37:32.556 DEBUG 5008 --- [nio-8443-exec-2] s.w.s.h.LoggingWebSocketHandlerDecorator : StandardWebSocketSession[id=e72b5731-63a9-19a2-7ce4-7c9d8db2a574, uri=wss://localhost:8443/magicmirror] closed
with CloseStatus[code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages]
2020-04-09 22:37:32.561 DEBUG 5008 --- [nio-8443-exec-2] o.a.c.h.u.UpgradeProcessorInternal       : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@18bd5b2e:org.apache.tomcat.util.net.SecureNioChannel@4f1b41c6:java.nio.channels.SocketChannel[connected local=ip6-localhost/0:0:0:0:0:0:0:1:8443 remote=/0:0:0:0:0:0:0:1:40954]], Status in: [OPEN_READ], State out: [CLOSED]
2020-04-09 22:37:32.561 DEBUG 5008 --- [nio-8443-exec-2] o.apache.tomcat.util.threads.LimitLatch  : Counting down[https-jsse-nio-8443-exec-2] latch=7
2020-04-09 22:37:32.561 DEBUG 5008 --- [nio-8443-exec-2] org.apache.tomcat.util.net.NioEndpoint   : Socket: [org.apache.tomcat.util.net.SecureNioChannel@4f1b41c6:java.nio.channels.SocketChannel[closed]] closed

I applied your suggested patch and ... the websockets error went away - yay progress!

Unfortunately, I now have a new error:

This time properly printed to the console on the web page:

Received message: {"id":"error","message":"Unexpected error while processing method: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/persistence.cpp:6628: error: (-2) The node does not represent a user object (unknown type?) in function cvRead\n (Code:-32603, Type:null, Data: null)"}
Error message from server: Unexpected error while processing method: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/persistence.cpp:6628: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
 (Code:-32603, Type:null, Data: null)

I've attached a patch of what worked for me with Harry's fix for reference but I'll hold off on proposing it until I actually get it to work.

Anyone have thoughts on the new error?   Thanks in advance.

Also, @Micael - I have looked at openvidu a bit but I was hoping to do some server side image processing rather than video conferencing so I think (please correct me if I'm wrong) that Kurento is a better fit.  Thanks for the reply!

- Rob
.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
kurento-socket-size.diff

Harry Cummings

unread,
Apr 10, 2020, 7:22:33 AM4/10/20
to kurento
Hi Rob,

Thanks for confirming. I'll raise a PR now to update all the Java tutorials.

Yep, I enabled debug logging in roughly the same way as in your patch (sorry, I could have shared that in the first place and possibly saved you a bit of time!).

I don't recognize your new error, but I haven't been using any of the image processing filters. The face recognition filter (used in the magic mirror tutorial that you're running), is based on OpenCV. So I think the error your seeing in the browser is ultimately coming all the way from the Kurento Media Server. If you look at the logs for KMS itself you might be able to find more information.

Cheers,
Harry

On Monday, April 6, 2020 at 5:40:51 AM UTC+1, Rob Sherwood wrote:

Harry Cummings

unread,
Apr 10, 2020, 7:31:30 AM4/10/20
to kurento
PR for the Java tutorials opened here: https://github.com/Kurento/kurento-tutorial-java/pull/14


On Monday, April 6, 2020 at 5:40:51 AM UTC+1, Rob Sherwood wrote:
Reply all
Reply to author
Forward
0 new messages