3

I have a (pretty simple) Windows console application which I want to run on a Linux server using Wine. When I just run it from the terminal over SSH like

wine myapp.exe

everything works great. It runs fine, does everything it should and CPU usage is pretty low (around 5%).

Problems start when I try to run it in background. Even simple things like

nohup wine myapp.exe

causes CPU usage to skyrocket to 100% (one full core). Redirecting output to /dev/null etc. doesn't help.

I tried running it using upstart with the following settings:

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec sudo -H -u myuser wine /path/to/my/app.exe &> /dev/null

CPU usage was 100%. I tried several more options, until I found out that the following version (with wineconsole used instead of wine and the "-b" switch added to sudo) works just fine (CPU usage 5-7%):

exec sudo -b -H -u myuser wineconsole /path/to/my/app.exe

The problem is, if I run it like this, upstart doesn't track the pid and so respawn etc. doesn't work. When I add "expect-fork" to the config, CPU usage again rises to 100%. When I add redirection to /dev/null, CPU usage rises to 100%. Basically anything I do causes CPU usage to rise to 100%.

Do you have any ideas what may cause this effect?

Spc_555
  • 213
  • 4
  • 11

2 Answers2

2

Finally found the source of the problem and a solution (although the solution is definitely not perfect).

The problem is in fact caused by input redirection. When keyboard input is substituted by /dev/null, something inside wine or the program (I didn't investigate it) seemingly goes into a fast-running endless loop which causes high CPU load.

The solution I found is to add "console owner" to the Upstart config so it connects the process to the console. After it I was even able to redirect output correctly :)

Since the program is running on a dedicated server in a data center, this setting doesn't seem to cause any trouble.

Spc_555
  • 213
  • 4
  • 11
0

I had the same issue. Solution for me: first starting a Xvfb screen, and than export DISPLAY=:1.0 && wineconsole command

par4
  • 1