WRI-Cities / static-GTFS-manager

GUI interface for creating, editing, exporting of static GTFS data for a public transit authority
GNU General Public License v3.0
147 stars 46 forks source link

Linux binary: running without terminal and closing browser prevents program from running again #71

Open answerquest opened 6 years ago

answerquest commented 6 years ago

This is in an Ubuntu OS, and concerns Linux executable that is under development and hasn't been released yet as of release v1.4.2 (and you're going to see why).

Steps:

  1. Double-click on the GTFSManager executable to launch the program.
  2. Prompt asks whether you want to execute or execute in terminal. linux binary execute prompt
  3. We pick the default option ie Execute.
  4. In this mode, the terminal and the messages there never show up. Directly a browser tab opens with the program's home page.
  5. After some use, we close the browser tab to close the program.
  6. We double-click the program again to run it another time. After some waiting, we realise that nothing has happened.
  7. We double-click the program again and choose to execute in Terminal. An empty terminal opens but nothing happens there.. it's stuck.
  8. We run the program from another terminal opened at the folder instead of double-clicking:
    
    $ ./GTFSManager
    static GTFS Manager
    Fork it on Github: https://github.com/WRI-Cities/static-GTFS-manager/
    Starting up the program, loading dependencies, please wait...

Loaded dependencies, starting static GTFS Manager program. Traceback (most recent call last): File "GTFSManager.py", line 1258, in app.listen(port) File "site-packages/tornado/web.py", line 1986, in listen File "site-packages/tornado/tcpserver.py", line 144, in listen File "site-packages/tornado/netutil.py", line 163, in bind_sockets OSError: [Errno 98] Address already in use [9559] Failed to execute script GTFSManager


9. So unless we reboot the system, the program has effectively crashed.
answerquest commented 6 years ago

Analysis

Quickfix

To really terminate the program, ref: How to know what program is listening on a given port?

$ lsof -i :5000
COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
GTFSManag 7757 nikhil    3u  IPv6  96051      0t0  TCP *:5000 (LISTEN)
GTFSManag 7757 nikhil    4u  IPv4  96052      0t0  TCP *:5000 (LISTEN)

$ kill 7757
<no response but program is terminated, confirmed by being able to run it again>

Problem with Quickfix : If the target user was capable of this then I'd rather make them run the program from python 3 itself and not bother making a binary to begin with. :P

Longfix

The binary should force 'Execute in Terminal' option. Don't allow terminal-less execution. Or, spawn the terminal upon execution.

answerquest commented 6 years ago

A fix for #87 precludes this too, so the program-wont-run situation won't be caused anymore. However, if user regularly keeps running the program then soon many port numbers will be occupied plus memory wastage etc. Longfix yet to find.