Hello,
I recently ported a small application from Windows using winelib. The app uses a third-party DLL that I don't have source for (which is why I'm using winelib instead of just writing a Unix program). It seems to work fine, but it takes up 100% of the CPU all the time:
24916 activewv 25 0 1080 1080 920 R 50.2 0.2 44:06 0 wineserver 24938 activewv 16 0 0 0 0 Z 24.5 0.0 3:52 0 wine-pthread <defunct> 24913 activewv 15 0 0 0 0 Z 24.1 0.0 17:38 0 wine-pthread <defunct>
Also Linux claims that the two threads of the program are zombies, and are taking up 25% of the CPU, which doesn't really make any sense. The app isn't CPU-intensive under Windows.
The app is just sending a short request to the serial port every 5-10 seconds, and sometimes getting back a short response. When I strace wineserver, it's doing:
31132 poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}, {fd=7, events=POLLIN}, {fd=9, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=15, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=16, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=17, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=28, events=POLLIN}, {fd=-1}, { fd=-1}, {fd=-1}, {fd=32, events=0, revents=POLLERR|POLLHUP}, {fd=33, events=POLLIN, revents=POLLIN}, {fd=-1}, {fd=-1}, {fd=36, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=18, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=44, events=0, revents=POLLERR|POLLHUP}, {fd=45, events=POLLIN, revents=POLLIN}, {fd=-1}, {fd=-1}, {fd=48, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=24, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=56, events=POLLIN}, {fd=57, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=60, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=63, events=POLLIN}, {fd=64, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {fd=-1}, {! fd=71, events=POLLIN}, {fd=72, events=POLLIN}, {fd=-1}, {fd=-1}, {fd=75, events=POLLIN}, {fd=-1}, {fd=-1}], 69, -1) = 4 31132 read(33, "&\0\0\0\0\0\0\0\0\0\0\0L\0\0\0\0\0\0@\0\0\0\0\0\0\0\0\0"..., 64) = 64 31132 write(34, "\0\0\0\0\0\0\0\0\t\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0"..., 64) = 64 31132 read(45, "\25\0\0\0\0\0\0\0\0\0\0\0l\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 64) = 64 31132 write(46, "\0\0\0\0\0\0\0\0\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0"..., 64) = 64
Those file descriptors are all pipes according to lsof, and I'm not sure what they're connected to---although it seems likely they're connected to those two threads, especially since those are the only threads this copy of wineserver is servicing.
I'm not really sure how to go about figuring this out; I'm about to port another similar application, and I'd prefer not to have both of them trying to get the CPU all the time.
This is with Wine-20040309, compiled myself for a Fedora Core Release 1 (Yarrow) Linux.
I'm not really sure what my next step is in figuring this out. Any ideas?
Thanks!
----ScottG.
On 30 Apr 2004, Scott W Gifford wrote:
I'm not really sure what my next step is in figuring this out. Any ideas?
Do you have a similar behaviour if you just run the Windows executable under Wine?
"Dimitrie O. Paun" dimi@intelliware.ca writes:
On 30 Apr 2004, Scott W Gifford wrote:
I'm not really sure what my next step is in figuring this out. Any ideas?
Do you have a similar behaviour if you just run the Windows executable under Wine?
No, it uses a normal amount of CPU and works normally. I ported to Winelib because I had a hard time capturing stdout from the Windows console program properly just running the .exe under Wine.
----ScottG.
On 1 May 2004, Scott W Gifford wrote:
Do you have a similar behaviour if you just run the Windows executable under Wine?
No, it uses a normal amount of CPU and works normally. I ported to Winelib because I had a hard time capturing stdout from the Windows console program properly just running the .exe under Wine.
OK, I think this requires some investigation. What version of Wine are you using? You should be using the very latest CVS, there were some fixes applied recently. How did you port the app to Winelib? Are you using winegcc? If so, can you change winegcc -> gcc, and build a .exe with MinGW with the _exact_ same Makefile you use for Winelib? Is the resulting .exe working OK? Are you using -mno-cygwin or not? If not, add it and see what happens. If yes, remove it.
If none of these make a difference, we need to test the headers. I'm not sure if anyone did this before, so it may have a few tricky parts to it, but the idea would be to completely replace the MinGW headers with the Wine ones, and build the .exe again. How is this one running? (If replacing the headers is difficult, you can just specify them with -I on the command line).
Scott W Gifford gifford@umich.edu writes:
I ported to Winelib because I had a hard time capturing stdout from the Windows console program properly just running the .exe under Wine.
<shoot in the dark>Try wineconsole instead of wine, that may work better.</shoot in the dark>
Ferenc Wagner wferi@afavant.elte.hu writes:
Scott W Gifford gifford@umich.edu writes:
I ported to Winelib because I had a hard time capturing stdout from the Windows console program properly just running the .exe under Wine.
<shoot in the dark>Try wineconsole instead of wine, that may work better.</shoot in the dark>
Thanks Feri, but I'm already using wineconsole.
----ScottG.