fcgiwrap works exactly once #15

Open
opened 2022-05-19 22:03:48 +00:00 by stellarskylark · 4 comments

I was experimenting with running a Bash script with fcgiwrap. After booting the server, the very first request to my script (gemini://localhost/testscript.sh) succeeds, and outputs as expected. Any subsequent requests, however, fail. Restarting twins resets it; the first CGI request after restarting will succeed, and then every subsequent request fails.

This happens when reloading the same script and when trying to access a different script. It also occurs regardless of the language used for the script (I tried a Python script as well).

I have also confirmed that this is not a problem with fcgiwrap by testing with the nginx configuration from this website. Everything worked as expected with nginx.

My twins test configuration:

listen: localhost:1965
hosts:
    localhost:
        cert: /home/skylar/software/twins/localhost.crt
        key: /home/skylar/software/twins/localhost.key
        paths:
            - 
                path: /
                root: /home/skylar/software/cgi-test
                fastcgi: unix:/var/run/fcgiwrap.socket
            

And the script testscript.sh:

#!/bin/bash

echo 'Content-type: text/plain'
echo ''
echo "$(printenv)"
I was experimenting with running a Bash script with fcgiwrap. After booting the server, the very first request to my script (`gemini://localhost/testscript.sh`) succeeds, and outputs as expected. Any subsequent requests, however, fail. Restarting twins resets it; the first CGI request after restarting will succeed, and then every subsequent request fails. This happens when reloading the same script and when trying to access a different script. It also occurs regardless of the language used for the script (I tried a Python script as well). I have also confirmed that this is not a problem with fcgiwrap by testing with the nginx configuration from [this website](https://nassif-haynes.com/3/). Everything worked as expected with nginx. My twins test configuration: ``` listen: localhost:1965 hosts: localhost: cert: /home/skylar/software/twins/localhost.crt key: /home/skylar/software/twins/localhost.key paths: - path: / root: /home/skylar/software/cgi-test fastcgi: unix:/var/run/fcgiwrap.socket ``` And the script `testscript.sh`: ``` #!/bin/bash echo 'Content-type: text/plain' echo '' echo "$(printenv)" ```
tslocum added the
bug
help wanted
labels 2022-05-25 04:32:15 +00:00
Owner

Please run twins with --debug and share the output (including both requests).

Please run twins with --debug and share the output (including both requests).
Author

There's not much to show

$ ./twins -debug -config ./config.yaml
localhost:1965 - - - [2022-05-25 00:42:25] "GET /testscript2.sh Gemini" 20 - 0.0309
^C

The second request never prints a log. Any subsequent request never prints a log. But the process is still running and has to be killed with ^C. No extra debug information is printed either (I tried both --debug and -debug)

There's not much to show ``` $ ./twins -debug -config ./config.yaml localhost:1965 - - - [2022-05-25 00:42:25] "GET /testscript2.sh Gemini" 20 - 0.0309 ^C ``` The second request never prints a log. *Any* subsequent request never prints a log. But the process is still running and has to be killed with `^C`. No extra debug information is printed either (I tried both `--debug` and `-debug`)
Owner

Thanks. Seems like a deadlock. I will look into this and get back to you.

Thanks. Seems like a deadlock. I will look into this and get back to you.
Owner

I'm still looking into this, but if you dont mind the content type being Gemini instead of plain text, you can simply use the command directive instead, and point it directly to the bash script.

I'm still looking into this, but if you dont mind the content type being Gemini instead of plain text, you can simply use the `command` directive instead, and point it directly to the bash script.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tslocum/twins#15
No description provided.