hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
839 stars 204 forks source link

leak memory and libupnp "total jobs = 100, too many job" #26

Open devinzou opened 11 years ago

devinzou commented 11 years ago

hi, I meet some problem, I feel that gmediarender have leak memory problem, when I play mp3 music,it have 4762K memory throught free command,but it just have 3602K memory after play ten songs.After take some time,it only have 2862K memory. gstreamer 0.10.36 gst-plugins-base-0.10.36 gst-plugins-good-0.10.31 gst-plugins-ugly-0.10.19 gst-plugins-bad-0.10.23 glib-2.24.1 libupnp-1.6.18

And,my libupnp have the problem that "total jobs= 100, too many job". In configure libnpnp with '--disable-blocking_tcp_connections',but I don't known why the problem still appear. The CPU is mips,so the compile is mipsel-linux-gcc. Do you have any suggestions? ThankS!

hzeller commented 11 years ago

You are using an old and unmaintained gstreamer library. Your problem sounds like it is the consequence of the following gstreamer bug: https://bugzilla.gnome.org/show_bug.cgi?id=699794

Can you try gstreamer 1.0.8 ?

hzeller commented 11 years ago

Regarding "total jobs= 100, too many job" - what is the UPnP controller (the client application connecting to gmrender) you are using ? It could be that there are clients that constantly open new connections but don't close old ones (haven't seen before, but it could explain the behavior). Or it hangs in some operation within gstreamer.

So for more information, it would be good if you could post the stacktrace of all threads when it runs into the 'too many job' problem (connect with gdb to the process, then "thread apply all backtrace").

hzeller commented 11 years ago

Any luck with the new version of gstreamer ?

devinzou commented 11 years ago

Thanks, Hzeller I plan to use gstreamer1.1.3 in next phases, I want to ask you a question what whether gmrender-resurrect support windows media player' s seek feature, In my gmrender-resurrct , windows media player' s progress bar control can't be dropped, Do you have any suggestion? And I think xmlescape function maybe cause compatibility issues, do your purpose support foobar 2000 ? such as: variable-container.c : varvalues[0] = xmlescape(xml_doc_string, 0); upnp_device_notify(obj->upnp_device,obj->service_id,varnames, varvalues, 1); free((char*)varvalues[0]);

upnp_device.c: char *xml_value = UPnPLastChangeBuilder_to_xml(builder); Log_info("upnp", "Initial variable sync: %s", xml_value); eventvar_values[0] = xmlescape(xml_value, 0); free(xml_value); UPnPLastChangeBuilder_delete(builder);

rc = UpnpAcceptSubscription(priv->device_handle, sr_event->UDN, sr_event->ServiceId, eventvar_names, eventvar_values, 1, sr_event->Sid);

hzeller commented 11 years ago

"Seek" in general should work, it works at least with BubbleUPnP; I don't have Windows machine to test. When you seek with the Windows Media Player, do you see anything in the logs of gmrender ?

I once had a chance to test with Foobar 2000, and there was an XML problem, but that was due to some service-ID not set correctly. This should be fixed for about 2 months now - did you try the latest version from github ?

hzeller commented 11 years ago

This was the change, that should make Foobar 2000 work: https://github.com/hzeller/gmrender-resurrect/commit/bdb46e19b23e7049af629859b7db91ccf0550706

devinzou commented 11 years ago

Hi hzeller, I want to ask you a question. Is it necessary that call xmlescape function before UpnpAcceptSubscription and upnp_device_notify function, the xmlescape function is convert "<" ">" to "<" ">"

hzeller commented 11 years ago

Yes, because the value is an XML document itself that needs to be properly quoted if transferred as a value.

devinzou commented 11 years ago

Thanks,Hzeller I want to ask you another question. You ingore TRANSPORT_VAR_REL_TIME_POS/TRANSPORT_VAR_ABS_TIME_POS/TRANSPORT_VAR_REL_CTR_POS/TRANSPORT_VAR_ABS_CTR_POS/TRANSPORT_VAR_LAST_CHANGE variable in UPnPLastChangeCollector_callback function that do event them, Is it necessary event TRANSPORT_VAR_AV_URI/TRANSPORT_VAR_NR_TRACKS/TRANSPORT_VAR_CUR_TRACK/TRANSPORT_VAR_CUR_TRACK_URI/TRANSPORT_VAR_CUR_TRACK_META/TRANSPORT_VAR_TRANSPORT_STATE/TRANSPORT_VAR_CUR_TRANSPORT_ACTIONS when render finish play a song. I want to don't event them but inform_play_transition_from_output function call replace_transport_uri_and_meta("", "") 、 replace_current_uri_and_meta("", "") and change_transport_state(TRANSPORT_STOPPED) function. whether it or not ignore them like you?

devinzou commented 11 years ago

TRANSPORT_VAR_TRANSPORT_STATE and TRANSPORT_VAR_CUR_TRANSPORT_ACTIONS should be not ingored

hzeller commented 11 years ago

I don't fully understand what you need.

The REL_TIME_POS, ABS_TIME_POS, REL_CTR_POS and ABS_CTR_POS are ignored, because according to the specification document, AVTransport-v1 document, 2.3.1 Event Model, these should not be evented, as they potentially change every second. There is also LAST_CHANGE ignored, because it actually is the document itself that is evented. (you can disable this, if you comment out things in upnp_transport.c, around line 1034, where all the variables to be ignored are set).

The other variables, such as VAR_TRANSPORT_STATE etc. are evented, you can see this when you if you switch on the logfile. Or maybe I don't really understand what you mean ?