1

Topic: Banned

After upgrading to 0.9.3, http://ochiba.muchan.org/ has abruptly decided that I and everyone else are banned from the website. It takes an awful long time to return the page, though, sometimes timing out.

Any idea what could be causing this?

2

Re: Banned

This can happen if there is a database problem - can you double check the database string is correct? There was a format change with 0.9.3, so perhaps that's what causing the trip up (notably - sqlite DB strings should have 4 slashes at the beginning:

define("DB","sqlite:////path/to/my/sqlite.db");

Also, try running install.php - see if there is a more informative error there.

3

Re: Banned

My db is at /home/.taily/muchan/db/ochiba.sqlite and my db string is

define("DB","sqlite:////home/.taily/muchan/db/ochiba.sqlite");

When running install.php I get this (except with square brackets for the "nativecode=database is locked" thing)

Checking for presence of database ... OK - database doesn't exist yet

Installing database (sqlite) ... 

OOPS. Error attempting 'create table bans(ip primary key, date integer, tripcode, reason)'.

The error was: 5 ** create table bans(ip primary key, date integer, tripcode, reason) (nativecode=database is locked)

4

Re: Banned

Whoa. I don't know to make of that. Could you try

define("DB","/home/.taily/muchan/db/ochiba.sqlite");

and hit install.php again? It's supposed to recognize the old form as being SQLite.

5

Re: Banned

That produces:

Checking for database connection ... FAILED - please check connection settings (/home/.taily/muchan/db/ochiba.sqlite)

6

Re: Banned

This is really odd. Can you create a file called test.php as follows:

<?php
define("DB","sqlite:////home/.taily/muchan/db/ochiba.sqlite");
require("DB.php");
$db = DB::connect(DB);
if(DB::isError($db)) {
    die($db->getDebugInfo());
}
$result = $db->getAll("select * from categories");
if(DB::isError($result)) {
    die($result->getDebugInfo());
} else {
    var_dump($result);
}
?>

and then load that in your browser? What is the output? What is the output of pear info DB from a shell?

7

Re: Banned

test.php takes a while to load like the index, output:

5 ** select * from categories [nativecode=database is locked]

'pear info DB' output:

About DB-1.6.2
==============
Provides        Classes:                                         
Package         DB                                               
Summary         Database Abstraction Layer                       
Description     DB is a database abstraction layer providing:    
                * an OO-style query API                          
                * portability features that make programs        
                written                                          
                   for one DBMS work with other DBMS's           
                * a DSN (data source name) format for specifying 
                   database servers                                                  
                * prepare/execute (bind) emulation for databases 
                   that don't support it natively                
                * a result object for each query response        
                * portable error codes                           
                * sequence emulation                             
                * sequential and non-sequential row fetching as  
                   well as bulk fetching                         
                * formats fetched rows as associative arrays,    
                   ordered arrays or objects                     
                * row limit support                              
                * transactions support                           
                * table information interface                    
                * DocBook and PHPDoc API documentation           
                                                                                
                DB layers itself on top of PHP's existing        
                database extensions. The currently supported     
                extensions are:                                  
                dbase, fbsql, interbase, informix,               
                msql, mssql, mysql, mysqli,                      
                oci8, odbc, pgsql, sqlite and sybase.            
                                                                 
                DB is compatible with both PHP 4 and PHP 5.      
Maintainers     Stig Sæther Bakken <stig@php.net> (developer)    
                Tomas V.V.Cox <cox@idecnet.com> (developer)      
                Chuck Hagenbuch <chuck@horde.org> (helper)       
                Daniel Convissor                                 
                <danielc@analysisandsolutions.com> (lead)        
Version         1.6.2                                            
Release Date    2004-04-07                                       
Release License PHP License                                      
Release State   stable                                           
Release Notes   =============                                    
                BUGS FIXED:                                      
                                                                 
                - mysql, mysqli, sqlite, tests:                  
                Eliminate object to integer conversion notices        
                in                                               
                PHP5.  Issue arose due to change in PHP between  
                2004-03-21 and 2004-03-28.  Bug 1088.  (danielc) 
                                                                 
                - mysqli:                                        
                Move connection id to first argument in          
                mysqli_*() functions.  (Mark Reidenbach)         
                                                                 
                - mysqli:                                        
                Bring tableInfo() closer to working by using     
                mysqli_fetch_field().  (danielc)                 
                                                                 
                - oci8:                                          
                Pass $params from limitQuery() to                
                modifyLimitQuery() so can limit prepared         
                queries.                                         
                (danielc)                                        
                                                                 
                - pgsql:                                         
                Change isset() to !empty() for 'options' and     
                'tty'                                            
                elements of $dsninfo to keep empty strings from  
                being used in pg_connect() arguments.  (danielc)          
Release Deps    PHP >= 4.2.0                                     
                Package PEAR >= 1.0b1                            
Last Modified   2005-08-05

8

Re: Banned

Hmm. Did your provider upgraded sqlite recently? Can you check the output of phpinfo() and see what version of the sqlite library is in use?

9

Re: Banned

Also, is the database file on an NFS volume by any chance?

10

Re: Banned

I'm using a local compile of SQLite 2.8.14... haven't changed it since getting ochiba in place.  I don't know what filesystem Dreamhost uses on their servers.

11

Re: Banned

Can you try replacing functions.php with that from version 0.9.2? This should help narrow it down to PEAR::DB if that's the case...

12

Re: Banned

Using the old functions.php it displays the index page and home.tmpl correctly, but it still takes an incredibly long time to respond, and appends this to the end: "Warning: sqlite_fetch_array() expects parameter 1 to be resource, boolean given in /home/.taily/muchan/ochiba.muchan.org/includes/functions.php on line 96"

Trying to navigate produces "Warning: sqlite_array_query(): database is locked in /home/.taily/muchan/ochiba.muchan.org/includes/functions.php on line 336. Database query failed." on most pages.

13

Re: Banned

Well, at this point, I'm starting to think the database file got corrupted somehow (whether this has to do with the upgrade, I'm not sure - I can't think of why, though). Apparently, this happens sometimes with SQLite and no answers seem obvious.

Do you have a backup? Can you send me the file in question I can see about rebuilding it.

14

Re: Banned

OK, I put it up at http://ochiba.muchan.org/ochiba.sqlite
Thanks for going to that much trouble.

If you are able to fix it, how much work would it be to write a script to transfer the data to a mysql db? I'd rather not have this happen again.

15

Re: Banned

http://ochiba.x-maru.org/muchan.zip
This contains the dump file, and a rebuilt database (named muchan.sqlite). Let me know once you've grabbed it so I can remove it.

You should be able to build a import script for mysql from the dump file...

16

Re: Banned

Okay, I got the database, but am still getting the same 'banned' message. :| I have no more ideas, so I guess I'll redo it by hand using a mysql db once I feel like it... Thanks for trying to help, anyway.

17

Re: Banned

Truly bizarre stuff. I just did a "fresh" install of 0.9.3, but dropped your database and it seems to work fine (other than all the thumbs and images not being there). Some other things to try, if you feel like:

* Try using a different name for the database (muchan.sqlite, for example) and adjust the DB paramter in conf.php- maybe the "ochiba.sqlite" is poisoned somehow
* Restart the apache process if you are able (might be that it has a stale connection to it that needs to be released)
* Restart the server if possible (again, clear away stale locks)
* Roll back to ochiba 0.9.2

I'll play around with a conversion to an importable Mysql file when I get a chance.

18

Re: Banned

Here's the mysqldump output of the conversion of your database:

http://ochiba.x-maru.org/muchan.mysql.gz

G'luck!