Giter Club home page Giter Club logo

Comments (18)

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024 1

@chr15m so that was it! Works now.

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

Just did a netstat -lptn under the piku user and got this... 😕

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -

from piku.

chr15m avatar chr15m commented on May 28, 2024

Will see if I can replicate.

from piku.

chr15m avatar chr15m commented on May 28, 2024

Are there multiple instances of uwsgi emperor running?

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

how can I tell that?

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

this is the only piku app running on a clean install.

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024
piku@pikuserver:/home/pi $ ps aux | grep python
piku      5165  0.0  1.3  21272 13168 ?        Ss   13:54   0:02 python3 /home/piku/piku.py logs myapp
piku      5723  0.0  0.0   1940   368 ?        Ss   14:15   0:00 /bin/sh -c python3 myapp.py
piku      5724  0.3  1.9  27572 19820 ?        S    14:15   0:03 python3 myapp.py
piku      5736  0.1  1.3  21272 13180 ?        Ss   14:15   0:01 python3 /home/piku/piku.py logs myapp
piku      5884  0.0  0.0   7348   524 pts/0    S+   14:31   0:00 grep --color=auto python

piku@pikuserver:/home/pi $ ps aux | grep uwsgi
piku      4459  0.0  0.9  52236  9012 ?        S    12:11   0:00 uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini --daemonize /home/piku/.piku/uwsgi/uwsgi.log --pidfile /home/piku/.piku/uwsgi/uwsgi-piku.pid
piku      4461  0.0  0.3  45940  3460 ?        S    12:11   0:00 uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini --daemonize /home/piku/.piku/uwsgi/uwsgi.log --pidfile /home/piku/.piku/uwsgi/uwsgi-piku.pid
piku      4471  0.0  1.0 117764 10980 ?        Sl   12:11   0:00 uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini --daemonize /home/piku/.piku/uwsgi/uwsgi.log --pidfile /home/piku/.piku/uwsgi/uwsgi-piku.pid
piku      5886  0.0  0.0   7348   468 pts/0    S+   14:32   0:00 grep --color=auto uwsgi

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

so...

  • piku destroy myapp
  • rebooted rpi
  • git push piku master

still getting the "port in use"... :(

going to try one of the simple sample apps next...

from piku.

virtadpt avatar virtadpt commented on May 28, 2024

You definitely have two copies running there - there are two instances of python3 /home/piku/piku.py logs myapp in your process table.

How are you starting up Piku? Automatically on boot? Manually (inside of Screen or tmux, maybe)?

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

This is a clean install of Piku onto a Raspberry Pi Buster distro.

I must have had two piku logs running then because I just did this:

piku@pikuserver:/home/pi $ ps aux | grep python
piku       861  0.0  0.0   1940   388 ?        Ss   10:58   0:00 /bin/sh -c python3 myapp.py
piku       862  0.1  1.9  27400 19524 ?        S    10:58   0:21 python3 myapp.py
piku      1435  0.0  0.0   7348   468 pts/0    S+   14:07   0:00 grep --color=auto python

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

this looks concerning... is these three instants of uwsgi running?

piku@pikuserver:/home/pi $ ps aux | grep uwsgi
piku       284  0.0  1.0  52236 10796 ?        Ss   10:43   0:01 /usr/local/bin/uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini
piku       327  0.0  0.3  45940  3404 ?        S    10:43   0:01 /usr/local/bin/uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini
piku       329  0.0  1.0 117764 10692 ?        Sl   10:43   0:00 /usr/local/bin/uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini
piku      1438  0.0  0.0   7348   472 pts/0    S+   14:13   0:00 grep --color=auto uwsgi

from piku.

chr15m avatar chr15m commented on May 28, 2024

@dwightmulcahy I think this is just the way uwsgi does process management. I have the same thing:

root@piku:~# ps aux | grep uwsgi
piku      5453  0.0  0.5  43764  5244 ?        Ss   Aug03   5:24 /usr/local/bin/uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini
piku      5456  0.0  0.2  39272  2252 ?        S    Aug03   9:56 /usr/local/bin/uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini
piku      5467  0.0  0.6 125144  6396 ?        Sl   Aug03   0:00 /usr/local/bin/uwsgi-piku --ini /home/piku/.piku/uwsgi/uwsgi.ini
root     31109  0.0  0.1  12944  1032 pts/0    S+   02:18   0:00 grep --color=auto uwsgi

And when I use pstree to visualise the tree I get this:

root@piku:~# pstree -p 5453
uwsgi-piku(5453)─┬─uwsgi-piku(5456)─┬─uwsgi(2649)───sh(4385)───server(4386)
                 │                  ├─uwsgi(5458)───sh(28207)─┬─cat(28209)
...
                 └─uwsgi-piku(5467)───{uwsgi-piku}(5511)

As you can see the first process spawns multiple subprocesses, and those are what actually manage running instances.

from piku.

chr15m avatar chr15m commented on May 28, 2024

@virtadpt you said:

there are two instances of python3 /home/piku/piku.py logs myapp in your process table.

Which is fine as this is just the logging command, and it was probably run on two separate shells.

from piku.

chr15m avatar chr15m commented on May 28, 2024

@dwightmulcahy looks like there has been a regression. I am trying to this with a minimal uwsgi example and without the PORT setting and seeing the same:

wsgi.1 | probably another instance of uWSGI is running on the same address (127.0.0.1:58786).
wsgi.1 | bind(): Address already in use [core/socket.c line 769]

from piku.

chr15m avatar chr15m commented on May 28, 2024

@dwightmulcahy Ok, I think I've figured this one out and it's a weird one.

If no NGINX_SERVER_NAME is specified then piku will insert http and http-socket directives into the uwsgi config: https://github.com/piku/piku/blob/master/piku.py#L889-L890

This is apparently causing the clash because if I change http-socket to http-use-socket then the bind error goes away and the uwsgi app is launched correctly. I never ran into this myself as I always have NGINX_SERVER_NAME set and don't use a custom PORT.

Do you want to make that change to your piku.py (to http-use-socket) and let me know if it fixes it for you? If it does I'll send a PR with the fix.

from piku.

dwightmulcahy avatar dwightmulcahy commented on May 28, 2024

I'll try it tomorrow morning and get back to you.

from piku.

chr15m avatar chr15m commented on May 28, 2024

Cool, wow, this has been broken for years.

from piku.

chr15m avatar chr15m commented on May 28, 2024

@dwightmulcahy I've pushed a PR to fix this. Thanks for testing.

from piku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.