novnc / noVNC

VNC client web application
https://novnc.com
Other
11.68k stars 2.31k forks source link

Return codes without -f #11

Closed rickr closed 14 years ago

rickr commented 14 years ago

It looks as if error codes are not returned correctly when not using -f.

Console log:

[root@brawndo include]# ps -ef | grep ws root 2302 15791 0 20:41 pts/1 00:00:00 grep ws [root@brawndo include]# /var/www/html//noVNC/utils/wsproxy.py 4951 localhost:59510 [root@brawndo include]# echo $? 0 [root@brawndo include]# ps -ef | grep ws root 2307 1 0 20:42 ? 00:00:00 /usr/local/bin/python /var/www/html//noVNC/utils/wsproxy.py 4951 localhost:59510 root 2309 15791 0 20:42 pts/1 00:00:00 grep ws [root@brawndo include]# /var/www/html//noVNC/utils/wsproxy.py 4951 localhost:59510 [root@brawndo include]# echo $? 0 [root@brawndo include]# ps -ef | grep ws root 2307 1 0 20:42 ? 00:00:00 /usr/local/bin/python /var/www/html//noVNC/utils/wsproxy.py 4951 localhost:59510 root 2317 15791 0 20:42 pts/1 00:00:00 grep ws [root@brawndo include]# /var/www/html//noVNC/utils/wsproxy.py -f 4951 localhost:59510 Traceback (most recent call last): File "/var/www/html//noVNC/utils/wsproxy.py", line 160, in start_server() File "/var/www/html/noVNC/utils/websocket.py", line 194, in start_server lsock.bind((settings['listen_host'], settings['listen_port'])) File "/usr/local/lib/python2.7/socket.py", line 222, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 98] Address already in use [root@brawndo include]# echo $? 1

kanaka commented 14 years ago

Fixed with commit 31407ab.

The problem was that the listen port was opened after daemonizing which means that the error could not be reported back to the user. The solution was to daemonize after opening the listen port. This means the listen socket has to be skipped when closing fds during daemonizing.

Thanks for the report rickr.