[Mono-dev] Unix-sockets & Mono.WebServer.FastCgi

Daniel Lo Nigro lists at dan.cx
Thu Feb 20 06:45:16 UTC 2014


That sounds like a bug - It's probably worth reporting it as such.


On Mon, Feb 17, 2014 at 10:36 PM, SirNoSkill <quandary82 at hailmail.net>wrote:

> Hi,
>
> I downloaded the sources for XSP from git.
> And it seems Mono.WebServer.FastCgi has been under quite a bit of
> change.
> First I wanted to thank the person(s) responsible for it, seems like the
> fastcgi server is finally stable, or at least stable enough that it
> hasn't crashed once in the last 2 weeks, including a performance load
> test.
> Keep up the good work.
>
> One thing though:
> It worked fine with TCP, but when I tried with unix sockets, I got this
> error:
> Error parsing permissions "". Use octal."
>
> In file
> /xsp/src/Mono.WebServer.FastCgi/main.cs
> in function public static bool TryCreateUnixSocket (string path, out
> Socket socket, string perm = null)
>
> there is this code:
> if (perm == null) {
>     socket = new UnixSocket (realPath);
>     Logger.Write (LogLevel.Debug, "Listening on file {0} with default
>     permissions", realPath);
> } else {
>     ushort uperm;
>     if (!UInt16.TryParse (perm, out uperm)) {
>         Logger.Write (LogLevel.Error, "Error parsing permissions
>         \"{0}\". Use octal.", perm);
>         return false;
>     }
>
>
> that should probably be
> if(string.IsNullOrEmpty(perm)){
> because UInt16.TryParse will fail if perm is string.Empty.
>
> If I fix this, fastcgi-server starts, but I get a HTTP 502.
> Since the config works fine if I use TCP, I guess this is a
> fastcgi-server bug.
> Just thought I let you know.
>
> It's unlikely it's a permission bug, since I let fastcgi-mono-server4
> run as root.
> Just in case, here my configuration settings:
>
> This is my fastcgi-start script
>
> #!/bin/sh
>
> ### BEGIN INIT INFO
> # Provides:          monoserve.sh
> # Required-Start:    $local_fs $syslog $remote_fs
> # Required-Stop:     $local_fs $syslog $remote_fs
> # Default-Start:     2 3 4 5
> # Default-Stop:      0 1 6
> # Short-Description: Start fastcgi mono server with hosts
> ### END INIT INFO
>
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> DAEMON=/usr/bin/mono
> NAME=monoserver
> DESC=monoserver
>
> MONOSERVER=$(which fastcgi-mono-server4)
> MONOSERVER_PID=$(ps auxf | grep fastcgi-mono-server4.exe | grep -v grep
> | awk '{print $2}')
>
> WEBAPPS="www.example.com:
> /:/root/VS2010/SqlWebAdmin/SqlWebAdmin/,example.com:
> /:/root/VS2010/SqlWebAdmin/SqlWebAdmin/"
>
> #WEBAPPS="www.domain1.xyz:/:/var/www/domain1.xyz/,www.domain2.xyz:/:/var/www/domain2.xyz/"
>
> case "$1" in
>         start)
>                 if [ -z "${MONOSERVER_PID}" ]; then
>                         echo "starting mono server"
>
>
>                         # ${MONOSERVER} /applications=${WEBAPPS}
>                         /socket=unix:/tmp/fastcgi.socket &
>                         # ${MONOSERVER} /applications=${WEBAPPS}
>                         /socket=tcp:127.0.0.1:9000 &
>                         ${MONOSERVER} /applications=${WEBAPPS}
>                         /socket=unix:/var/run/mono3-fcgi.sock &
>                         echo "mono server started"
>                 else
>                         echo ${WEBAPPS}
>                         echo "mono server is running"
>                 fi
>         ;;
>         stop)
>                 if [ -n "${MONOSERVER_PID}" ]; then
>                         kill ${MONOSERVER_PID}
>                         echo "mono server stopped"
>                 else
>                         echo "mono server is not running"
>                 fi
>         ;;
>         *) echo "You have provided no or an invalid command line
>         argument."
>         ;;
> esac
>
> exit 0
>
>
>
> and this the nginx configuration
>
>
> ##
> # You should look at the following URL's in order to grasp a solid
> understanding
> # of Nginx configuration files in order to fully unleash the power of
> Nginx.
> # http://wiki.nginx.org/Pitfalls
> # http://wiki.nginx.org/QuickStart
> # http://wiki.nginx.org/Configuration
> #
> # Generally, you will want to move this file somewhere, and start with a
> clean
> # file but keep this around for reference. Or just disable in
> sites-enabled.
> #
> # Please see /usr/share/doc/nginx-doc/examples/ for more detailed
> examples.
> ##
>
>
>  server {
>          listen   80;
>          server_name www.example.com example.com;
>          access_log   /var/log/nginx/your.domain1.xyz.access.log;
>
>          location / {
>                  root /root/VS2010/SqlWebAdmin/SqlWebAdmin;
>                  #index index.html index.htm default.aspx Default.aspx;
>                  #fastcgi_index Default.aspx;
>                  #fastcgi_pass 127.0.0.1:9000;
>                  fastcgi_pass unix:/var/run/mono3-fcgi.sock;
>                  include /etc/nginx/fastcgi_params;
>          }
>
>
>
>
>         location /doc {
>                 root /usr/share;
>                 autoindex on;
>                 allow 127.0.0.1;
>                 deny all;
>         }
>
>         location /shared_images {
>                 root /usr/share;
>                 autoindex off;
>         }
>
>         error_page 404 /CustomErrors/404.htm;
>
>         # redirect server error pages to the static page /50x.html
>         #
>         #error_page 500 502 503 504 /50x.html;
>         #location = /50x.html {
>         #       root /usr/share/nginx/www;
>         #}
>
> }
>
>
> /etc/hosts entries:
> 127.0.0.1       example.com
> 127.0.0.1 www.example.com
>
>
> Kind regards
>
> NoSkillz
>
> --
> http://www.fastmail.fm - IMAP accessible web-mail
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140219/900ab75a/attachment.html>


More information about the Mono-devel-list mailing list