Skip to content

os/v3/puppy: 1bit-webapp-proxy dies on a port that is already bound, with a bare traceback (the chat page is not served) #958

Closed

Description

@bong-water-water-bong

Reported by pi-release after both the c19 and the c20 board boots, unchanged:

1bit-webapp-proxy: serving /opt/1bit/webapp on 127.0.0.1:8080, /api/ -> 127.0.0.1:13305 (no API key in /etc/1bit/lemond.conf)
  File "/usr/local/bin/1bit-webapp-proxy", line 142, in main
    srv = ThreadingHTTPServer(("127.0.0.1", PORT), Handler)
OSError: [Errno 98] Address already in use

So on that medium the API on :13305 works and the 1bit chat page on :8080 is not served. The log shows one instance printing its serving line and a second one dying, so the port is held by a second copy of the proxy (two starts inside the same boot); the traceback says neither which process holds it nor that the page is in fact already being served, and a booting stick cannot be ssh'd into to look.

Fix: bind-or-explain. Retry the bind briefly (the loser of a double start should not shout), and on the final failure read /proc/net/tcp (the LISTEN socket's inode) plus /proc/*/fd to name the holder and its cmdline in one line. If the holder is another instance of this proxy, say so and exit 0 - the page is served, only the second copy stops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions