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: Dmitry Borodaenko
Subject: Re: hints and problems with 0.5.5 .deb package
Date: Wed, 31 Aug 2005 14:45:05 +0300
User-agent: Mutt/1.5.10i

On Wed, Aug 31, 2005 at 01:51:09AM +0200, boud wrote:
> ** createuser samizdat : how-to revert privileges
> i eventually found the psql commands to change user samizdat's privileges:
> 
> alter user samizdat nocreatedb; 
> alter user samizdat nocreateuser;
> 
> Would this be worth putting this somewhere in the install in case the
> user said "y \n y" and wants to revert? In any case, this cannot be
> the cause of the message.rb problem.

Don't think too much about this one: for users who know PostgreSQL well,
it's almost obvious (and easy to find in Pg docs), for everyone else,
it's the part they shouldn't do manually, it should be done by the
script.

> ** apache/error.log + postgresql log
> 
> point where message.rb seems to fail is, IMHO, here:
> 
> apache/error.log: around Aug 30 23:10:09
> 
> LOG:  statement: SELECT id, login, full_name, email, login_time FROM Member 
> WHER
> E session = '0938278c78a9398631a1d00e1a9c947e'
> LOG:  statement: SELECT id, login, full_name, email, login_time FROM Member 
> WHER
> E session = '0938278c78a9398631a1d00e1a9c947e'
> [Tue Aug 30 23:10:09 2005] [notice] child pid 7901 exit signal Segmentation 
> faul
> t (11)
> LOG:  statement: SELECT oid, typname, typelem FROM pg_type WHERE typtype = 
> 'b';
> LOG:  statement: SELECT id, login, full_name, email, login_time FROM Member 
> WHER
> E session = '0938278c78a9398631a1d00e1a9c947e'
> [Tue Aug 30 23:10:12 2005] [notice] child pid 7904 exit signal Segmentation 
> faul
> t (11)
>  ...

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
Apache modules use PostgreSQL? Can you run them over with ldd
foo.so|grep libpq, like this:

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

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

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?

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
your data on command line. Enter something like
'title=test&content=blahblah' (without quotes) and hit Ctrl-D. It would
look like this (cut&paste from my console):

$ SAMIZDAT_BASE=/var/www/samizdat ruby message.rb
(offline mode: enter name=value pairs on standard input)
title=test&content=boo
Content-Type: text/html; charset=utf-8
Content-Length: 2758

<?xml version="1.0" encoding="UTF-8"?>
(...)
<div class="box">
  <div class="box-title">Message Preview</div><div class="box-content">
<div class="message" id="idupload">
<div class="title"><a title="Click to view the resource"
href="upload">test</a></div>
<div class="info">by&nbsp;guest on&nbsp;2005-08-31 14:35</div>
<div class="content">
<p>boo</p>
</div>

If you append '&confirm=Confirm' to the input, the engine will try to
actually write the message, if it work, you will get a redirect
responce:

$ SAMIZDAT_BASE=/var/www/samizdat ruby message.rb 
(offline mode: enter name=value pairs on standard input)
title=test&content=blahblah&confirm=Confirm
Status: 302 Found
Content-Type: text/html; charset=utf-8
location: 1

Then you can check if the engine can read and show this message:

$ 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
fails with segfault, it would mean that the problem lies within Ruby or
Ruby/Postgres.

> ** samizdat-drb-server
> i tried
> # Change to one to start samizdat-drb-server on boot
> ENABLED=1
> 
> /etc/init.d/samizdat restart
> 
> and got the same error (just different job numbers etc.)

Right, if it's segfaults you're getting, it's either a bug in Ruby
interpreter (extremely unlikely), or some .so conflict.

> ** another clue:
> Most of the "buttons" seem to work.  :))))

This proves that mod_ruby itself works fine.

> i clicked on "Enable advanced interface", and then, after i clicked
> on message.rb, i got a more advanced interface :).
> 
> This time, before clicking on "preview", i put some random text in 
> the box:
> "Reference to description (ID or URL of another message on this site)"
> and got the report:
> 
> User Error
> Invalid message reference.
> Press 'Back' button of your browser to return.
> 
> 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.

> Anyway, big log extracts are below...  i started looking at
> message.rb, and i have to admit that it looks fairly readable, even
> though i haven't yet looked at any web pages on ruby as a programming
> language... :)

Yeah, Micah told me the same thing when I showed him the code at
DebConf5 :)

> ----------------------------------------------------------------------
> 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.

(...)
>     <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?

-- 
Dmitry Borodaenko




reply via email to

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