samizdat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hints and problems with 0.5.5 .deb package


From: boud
Subject: Re: hints and problems with 0.5.5 .deb package
Date: Thu, 1 Sep 2005 05:18:50 +0200 (CEST)

hi dmitry, everyone,

On Wed, 31 Aug 2005, Dmitry Borodaenko wrote:

On Wed, Aug 31, 2005 at 01:51:09AM +0200, boud wrote:

** apache/error.log + postgresql log

Agreed, that's the point of failure. Apache child process dies with
segfault, and most likely it's our mod_ruby process, and most likely it
dies while executing an SQL statement.

If all these assumptions are true, it might be a version mismatch
between Pg library that Ruby/Posgres module was built against and
installed Pg version. It also might be a conflict between mod_ruby and
dynamic libraries it loads and other libraries loaded by other Apache
processes. Which non-sarge packages do you have installed? What other

There are installations of mir-1.1, twiki, and mediawiki on the same server
(testing only, not production!).

Apache modules use PostgreSQL? Can you run them over with ldd

Well, tomcat - but now i've turned it off.

foo.so|grep libpq, like this:

ldd /usr/lib/ruby/1.8/i386-linux/postgres.so|grep libpq

ldd /usr/lib/apache/1.3/mod_ruby.so
        libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0x40020000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x400e7000)
        libdl.so.2 => /lib/libdl.so.2 (0x40138000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4013c000)
        libm.so.6 => /lib/libm.so.6 (0x40169000)
        libc.so.6 => /lib/libc.so.6 (0x4018b000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)

ldd /usr/lib/ruby/1.8/i386-linux/postgres.so
        libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0x4000f000)
        libpq.so.3 => /usr/lib/libpq.so.3 (0x400d6000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x400f1000)
        libdl.so.2 => /lib/libdl.so.2 (0x40107000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4010a000)
        libm.so.6 => /lib/libm.so.6 (0x40137000)
        libc.so.6 => /lib/libc.so.6 (0x40159000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x4028c000)
        libssl.so.0.9.7 => /usr/lib/i586/libssl.so.0.9.7 (0x402dd000)
        libcrypto.so.0.9.7 => /usr/lib/i586/libcrypto.so.0.9.7 (0x4030b000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x403f8000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x40460000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x40472000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x40495000)

ldd /usr/lib/postgresql/bin/postgres
        libpam.so.0 => /lib/libpam.so.0 (0x4001e000)
        libssl.so.0.9.7 => /usr/lib/i586/libssl.so.0.9.7 (0x40026000)
        libcrypto.so.0.9.7 => /usr/lib/i586/libcrypto.so.0.9.7 (0x40053000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x40140000)
        libz.so.1 => /usr/lib/libz.so.1 (0x401a9000)
        libreadline.so.4 => /lib/libreadline.so.4 (0x401bb000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x401e7000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x40214000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40226000)
        libdl.so.2 => /lib/libdl.so.2 (0x4023b000)
        libm.so.6 => /lib/libm.so.6 (0x4023f000)
        libc.so.6 => /lib/libc.so.6 (0x40261000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x40394000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x40397000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x403ba000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

ldd /usr/lib/apache/1.3/mod_jk.so
        libc.so.6 => /lib/libc.so.6 (0x40023000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)


Can it be other library conflict, like e.g. libssl?

ldd /usr/lib/i586/libssl.so.0.9.7
        libcrypto.so.0.9.7 => /usr/lib/i586/libcrypto.so.0.9.7 (0x40034000)
        libdl.so.2 => /lib/libdl.so.2 (0x40121000)
        libc.so.6 => /lib/libc.so.6 (0x40124000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)


I've got an impression that the segfault only happens when you try to
actually fetch some data from db, when there's no data, selects and
updates seemed to work fine. Can you confirm this?

Well, the following buttons from the web interface give responses
(new web pages) without errors:
item.rb
query.rb   (gives: "No matching resources found.", but that's seems OK)
member.rb
etc.

You might also want to try to run message.rb from command line, this
snippet from Samizdat database connection code should explain why and
how that would work:

   db = DBI.connect(config['db']['dsn'].untaint,
     (ENV['USER'] or config['db']['user']),
     ENV['USER']? nil : config['db']['passwd'])

That is, if you did create your own PostgreSQL account and this account
has access to the Samizdat database...

Ruby's CGI module will detect the terminal and will offer you to input
 ...
$ SAMIZDAT_BASE=/var/www/samizdat ruby resource.rb
(offline mode: enter name=value pairs on standard input)
id=1
Content-Type: text/html; charset=utf-8
Content-Length: 2401

If all of the above works, then the problem is inside Apache. If it

This all worked very nicely, there's now an article published. :P
This is a nice test - i like command line stuff ;). But i'm not convinced that most users would want to do this. Giving them all ssh
and postgres access would probably not be a good idea either.

Anyway, seriously: so ruby -> postgresql works, if apache is not
involved.


Hmmm:
The GNU/linux user which is called by apache is www-data (standard debian
option). As user www-data on the command line:
 psql samizdat
fails, because the implicit postgres username is also "www-data", and
there is no such user in the postgresql database of databases.
 psql samizdat samizdat
works.

The error message from:
 psql samizdat
is
 psql: FATAL:  IDENT authentication failed for user "www-data"

Now, as GNU/linux user www-data,

SAMIZDAT_BASE=/var/www_samizdat/samizdat ruby 
/usr/lib/cgi-bin/samizdat/message.rb
test=yo&content=maybe&confirm=Confirm
Content-Type: text/html; charset=utf-8
Content-Length: 2603

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 ...

This failed the first time:

<p>Runtime error has occured: FATAL:  IDENT authentication failed for user 
"www-data"
 .</p>
<pre>/usr/lib/ruby/1.8/samizdat/engine/session.rb:29:in `request'
/usr/lib/cgi-bin/samizdat/message.rb:50</pre>
<p>Please report this error to the site administrator.</p>

but i seemed to have changed something and now message.rb works without
error, but resource.rb still fails for gnu/linux user  www-data:

<div id="main">
<div class="box">
  <div class="box-title">Runtime Error</div><div class="box-content">
<p>Runtime error has occured: FATAL:  IDENT authentication failed for user 
"www-data"
 .</p>
<pre>/usr/lib/ruby/1.8/samizdat/engine/session.rb:29:in `request'
/usr/lib/cgi-bin/samizdat/resource.rb:61</pre>
<p>Please report this error to the site administrator.</p>





i went back, removed the random text from the box "Reference to ...",
clicked "preview", and got back to the earlier error - delay, and after
many seconds, "The document contains no data."

Strange. You could get previous error because of some caching
(Shift-Control-R helps to check this), but "no data" error probably
happens because of a problem in your Apache configs.

OK, another clue that the problem is in apache.



----------------------------------------------------------------------
apache vhost
----------------------------------------------------------------------
<VirtualHost 1.2.3.4:80>
(...)
    DocumentRoot /var/www_samizdat/samizdat
(...)
    AliasMatch
    ^/samizdat/(foci|history|index|item|login|logout|member|message|\
moderation|pingback|query|resource)\.rb /usr/lib/cgi-bin/samizdat/$1.rb

This shouldn't work at all: if your DocumentRoot already includes
/samizdat, you shouldn't repeat it here, AliasMatch works on location,
not on file path.

Hmmm... i've read (for the n-th time):
http://httpd.apache.org/docs/2.0/vhosts/name-based.html#compat

and i think i finally ;) understand this directive:
ServerPath /samizdat

Anyway, now i have both
    AliasMatch
    ^/samizdat/(foci|history|index|item|login|logout|member|message|\
  moderation|pingback|query|resource)\.rb /usr/lib/cgi-bin/samizdat/$1.rb
and
    AliasMatch
    ^/(foci|history|index|item|login|logout|member|message|\
  moderation|pingback|query|resource)\.rb /usr/lib/cgi-bin/samizdat/$1.rb

and so both addresses in the format

http://server.domain.org/samizdat/[something]

and

http://server.domain.org/[something]

work.

The top-left link seems to be hard-wired for the http://server.domain.org/samizdat/[something] version, in which case AliasMatch ^/samizdat/(foci|history ... and similar for RewriteRule ... Alias /css/ etc. are needed.

IMHO, there's probably not much point having the ServerPath directive
unless you have other alias/rewrite stuff consistent. Otherwise the
people with really, really old browsers will get just one or two pages
and the rest will fail.



(...)
    <Directory /usr/lib/cgi-bin/samizdat>
        Options ExecCGI
#        SetEnv SAMIZDAT_DRB druby://localhost:9000

If you enabled distributed cache, you might as well uncomment the above
line, so that it's actually used :)

(...)
    Alias /samizdat/css/ /usr/share/samizdat/css/
#    Alias /content/ /var/www/samizdat/content/
    Alias /samizdat/content/ /var/www_samizdat/samizdat/content/

Once again, I don't grok why it works... How does '/samizdat' get into
your URL?

From ServerPath - which you recommended back in May 2005:
http://lists.gnu.org/archive/html/samizdat-devel/2005-05/msg00007.html

Previously, i was trying to keep several servers running on the same domain name, so i needed the directory name to separate them.

Now i've commented out the other servers - there's only samizdat ;).


Anyway, since the problem seems to be apache:

dpkg -l|grep apache
ii  apache         1.3.33-6       versatile, high-performance HTTP server
ii  apache-common  1.3.33-6       support files for all Apache webservers
rc  apache-ssl     1.3.33-6       versatile, high-performance HTTP server with
ii  apache-utils   1.3.33-6       utility programs for webservers (transitiona
ii  apache2-utils  2.0.54-4       utility programs for webservers
ii  libapache-mod- 1.2.5-2        Apache 1.3 connector for the Tomcat Java ser
ii  libapache-mod- 4.3.10-16      server-side, HTML-embedded scripting languag
ii  libapache-mod- 1.2.4-1        Embedding Ruby in the Apache web server
ii  libapache-ruby 1.2.4-1        Ruby libraries for mod_ruby


and here's the present apache config:


NameVirtualHost 1.2.3.4:80

<VirtualHost 1.2.3.4:80>
    ServerName server.domain.org
    ServerPath /samizdat
    ServerAdmin address@hidden
    CustomLog /var/log/apache/samizdat/access.log webalizer
    LogLevel debug
    ErrorLog /var/log/apache/samizdat/error.log

    DocumentRoot /var/www_samizdat/samizdat


    <Directory /var/www_samizdat/samizdat>
        Options None
        AllowOverride None
#        AllowOverride FileInfo Indexes Options

        <Files config.yaml>
            Order allow,deny
            Deny from all
        </Files>
    </Directory>


    DirectoryIndex index.rb
    AliasMatch 
^/samizdat/(foci|history|index|item|login|logout|member|message|moderation|pingback|query|resource)\.rb
 /usr/lib/cgi-bin/samizdat/$1.rb
    AliasMatch  
^/(foci|history|index|item|login|logout|member|message|moderation|pingback|query|resource)\.rb
 /usr/lib/cgi-bin/samizdat/$1.rb
    RewriteEngine on
    RewriteRule ^/([0-9]+)$ /resource.rb?id=$1 [PT]
    RewriteRule ^/samizdat/([0-9]+)$ /samizdat/resource.rb?id=$1 [PT]

    <IfModule mod_ruby.c>
       RubyRequire apache/ruby-run
    </IfModule>

    <Directory /usr/lib/cgi-bin/samizdat>
        Options ExecCGI
#        SetEnv SAMIZDAT_DRB druby://localhost:9000
#        SetEnv SAMIZDAT_BASE /var/www/samizdat
        SetEnv SAMIZDAT_BASE /var/www_samizdat/samizdat
        <Files *.rb>
            SetHandler cgi-script
#            <IfModule mod_fastcgi.c>
#                SetHandler fastcgi-script
#            </IfModule>
            <IfModule mod_ruby.c>
                SetHandler ruby-object
                RubyHandler Apache::RubyRun.instance
            </IfModule>
        </Files>
        <Files pingback.rb>
            SetHandler cgi-script
        </Files>
        <LimitExcept GET POST>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>

    Alias /samizdat/css/ /usr/share/samizdat/css/
    Alias /css/ /usr/share/samizdat/css/
#
#    <Directory /usr/share/samizdat/css>
#         Options Indexes MultiViews
#         AllowOverride None
#         Order allow,deny
#         Allow from all
#    </Directory>


#    Alias /content/ /var/www/samizdat/content/
#
    Alias /samizdat/content/ /var/www_samizdat/samizdat/content/
    Alias /content/ /var/www_samizdat/samizdat/content/
#
    <Directory /var/www_samizdat/samizdat/content>
        Options Indexes
        <Files *.rb>
            Order deny,allow
            Deny from all
        </Files>
        <LimitExcept GET>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>
</VirtualHost>



pozdr
boud






reply via email to

[Prev in Thread] Current Thread [Next in Thread]