Some follow up:

debugged the whole thing a bit with current xfreerdp from 68c7bcc6501b6df12ad75d65c7b4c2685fb755e4


I could not get any stream in the pool to grow beyond 162k

The chunks that get copied (released with Stream_Free) are 2MB during file copy from xfreerdp host to RDP server.


regards

Armin

On 01.09.20 15:52, Armin Novak via FreeRDP-devel wrote:
Hi Jonatan,


No, the dynamic channel write method is internal to libfreerdp2.so, so
you should not have to do anything there.

Could you clarify which stream is growing so large?

All buffers should be much smaller even with large files.


regards

Armin

On 01.09.20 15:19, Jonatan Volkov via FreeRDP-devel wrote:
Hi Armin,

Thank you for your reply.
I am talking about copying a file via a shared drive.

Meanwhile we have seen that FreeRDP 2.0.0 was using Stream_Free() to free
the wStream that was initially passed to FreeRDP_VirtualChannelWriteEx,
while 2.2.0 uses Stream_Release.
It is most likely that the current implementation in Guacamole server is
still aligned for the 2.0.0 way.
If we are copying a large file (several GB) then memory can run out during
the copy operation itself, so only releasing the buffers after the file is
finished copying does not cover us. Or maybe I misunderstood the usage you
propose for CHANNEL_EVENT_WRITE_COMPLETE ?

Thanks!
Jonatan


---------- Forwarded message ---------
From: Armin Novak via FreeRDP-devel <freerdp-devel@lists.sourceforge.net>
Date: Tue, Sep 1, 2020 at 10:27 AM
Subject: Re: [FreeRDP-devel] Memory not being freed during file copy via an
RDP session
To: <freerdp-devel@lists.sourceforge.net>


Hi,


could you please clarify a bit?

Are you talking about using a shared drive or clipboard file copy?


As for FreeRDP_VirtualChannelWriteEx, you need to listen for
CHANNEL_EVENT_WRITE_COMPLETE and free any buffer supplied before there.
(see any of the channels like clipboard using that)


regards

Armin

On 31.08.20 23:09, Jonatan Volkov via FreeRDP-devel wrote:
Hi all,

I am trying to hunt down an issue where during an RDP session via Apache
Gaucamole, copying a file from a shared directory/drive to any location on
the RDP server reserves memory that never gets freed. This leak eventually
brings down the guac session process after ~3GB have been copied in such a
way (on a weak machine).
We are getting this with Guacamole 1.2.0 (over FreeRDP 2.2.0) - was not
happening with Guacamole 1.0.0 (over FreeRDP 1.1).

Using valgrind we have tracked the problem to the repeated calls to
FreeRDP_VirtualChannelWriteEx containing chunks of the copied file. The
arguments include a wStream object that was earlier created via
Stream_New.
It appears, and the valgrind trace supports it, that this wStream instance
never gets freed by FreeRDP.

I could not find an open issue or discussions on it. Has anyone
encountered
this problem, or in general has any idea regarding the root cause of this
leak?
Should we be using the StreamPool from the external code (Guacamole in
fact) rather than creating a new instance of the stream for each write
operation?

Thanks! Regards,
Jonatan

_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel
_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel


_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to