http://bugs.winehq.org/show_bug.cgi?id=19561
Summary: Very large memory leak when doing overlapped reads Product: Wine Version: 1.1.26 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: wineserver AssignedTo: wine-bugs@winehq.org ReportedBy: ronfischler@gmail.com
Created an attachment (id=22796) --> (http://bugs.winehq.org/attachment.cgi?id=22796) Program compiled and ready to run using mingw
WINE is buffering serial ports which is in conflict with using overlapped reads. Additionally, when using overlapped reads on a serial port, there is a large memory leak. Every time we receive a block of data on the port, (say 800 bytes in our case,) wineserver allocates many pages on the heap and does not free them afterwards. We are seeing as many as 21 pages lost to the heap every time we read a small block of data.
My company is creating a Monitor & Control product that works through serial ports, and we want it to be able to run on Linux netbooks (using USB to serial port adapters.) This memory leak is the only thing holding us up. The memory leak is too large for us to recommend to customers that our application can be used on Linux platforms using WINE.
We are including an attachment for a small program that captures the leak. The problem is a result of our call to readfile() in the do-while loop. It is using the overlappedRead feature. Every time this Win32 function call is made, 84K bytes disappears forever.
-Ron F.
http://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #1 from Ron Fischler ronfischler@gmail.com 2009-08-03 19:15:59 --- Created an attachment (id=22797) --> (http://bugs.winehq.org/attachment.cgi?id=22797) Source code that captures the problem
http://bugs.winehq.org/show_bug.cgi?id=19561
Ron Fischler ronfischler@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #22796|Program compiled and ready |Program compiled (using description|to run using mingw |mingw)
http://bugs.winehq.org/show_bug.cgi?id=19561
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source
http://bugs.winehq.org/show_bug.cgi?id=19561
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|download, source |testcase Alias|RonF. |
http://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #2 from Dmitry Timoshkov dmitry@codeweavers.com 2009-08-03 22:43:56 --- How have you figured out that it's wineserver who leaks the memory? Is there any particular place in wineserver you think is to blame?
http://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #3 from Ron Fischler ronfischler@gmail.com 2009-08-03 23:39:10 --- Dear Dmitry,
I don't know for sure if it is in wineserver, and even if it is I certainly do not know where - I have never looked through WINE code before, and I would not know where to look. However, if we use readfile() without the overlappedRead option the program works fine, and there is no growth in wineserver's heap. When overlappedRead is used with readfile(), winserver's heap grows at a fantastic rate (about 84K bytes with each read, even if only a few bytes are being read each time.)
Additionally, the program source provided in the attachment has been set up with no buffering, and yet readfile() is still returning data in blocks of approximately 400 bytes, so there appears to be a buffering layer of some kind down below that I suspect could be related to the memory leak.
Best Regards, Ron
http://bugs.winehq.org/show_bug.cgi?id=19561
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|wineserver |-unknown
http://bugs.winehq.org/show_bug.cgi?id=19561
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|major |minor
http://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #4 from Ron Fischler ronfischler@gmail.com 2009-08-04 19:01:28 --- Note: A popular open-source terminal program, TeraTerm Pro, (see http://www.tucows.com/preview/195282) exhibits exactly the same explosive heap growth in wineserver. Looking at it's source, it is using readfile() with overlapped reads.
-Ron
http://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #5 from Ron Fischler ronfischler@gmail.com 2009-08-04 19:10:40 --- A correction to my last note: the best place to get Tera Term Pro: http://en.sourceforge.jp/projects/ttssh2/releases/
http://bugs.winehq.org/show_bug.cgi?id=19561
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
http://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #6 from butraxz@gmail.com 2013-05-25 09:32:51 CDT --- No update for over 900 days. Is this still and issue in 1.5.31 or higher or is this abandoned ?
http://bugs.winehq.org/show_bug.cgi?id=19561
Helder 'Lthere' Magalhães helder.magalhaes@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |helder.magalhaes@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=19561
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #7 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-5.0-rc2?
https://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #8 from joaopa jeremielapuree@yahoo.fr --- Created attachment 66599 --> https://bugs.winehq.org/attachment.cgi?id=66599 compiled test
Compiled test. But I do not know how to use it.
https://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #9 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-7.0-rc3?
https://bugs.winehq.org/show_bug.cgi?id=19561
--- Comment #10 from joaopa jeremielapuree@yahoo.fr --- Anyone want to test? I do not know what program does (or should do)
https://bugs.winehq.org/show_bug.cgi?id=19561
Janne janne.kekkonen@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |janne.kekkonen@gmail.com
--- Comment #11 from Janne janne.kekkonen@gmail.com --- Hello,
i tested the original program with USB-serial port. Program seems to print what comes to serial port. In my test string was written to serial port with 1 second interval. String format: hh:mm:ss ABCDEFG \r \n
Tested with wine version 8.5 Linux is running on virtual box. I tested this also on windows and output was similar.
terminal log: jehu@jehu-VirtualBox:~/.wine/drive_c/temp$ wine sertest.exe -c2 -b19200 SerTest V1.01, using Overlapped Reads using comm port [\.\COM2] at 19200 baud Press [Control-C] to close this program 00:00:01 ABCDEFG 00:00:02 ABCDEFG 00:00:03 ABCDEFG 00:00:04 ABCDEFG 00:00:05 ABCDEFG ^C0130:fixme:console:default_ctrl_handler Terminating process 11c on event 0 wine client error:120: write: Bad file descriptor.
I have no idea how to monitor heap size of wineserver.