Author Topic: DB corrupted?  (Read 35708 times)

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
DB corrupted?
« on: October 12, 2008, 04:26:47 pm »
Good day to all.
This bug appears in version 0.9 after few days of testing. Then i delete installation and DB and reinstall opengoo. But the bug appears again....
Here it is (error.log from apache):

[Sun Oct 12 23:15:33 2008] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'InvalidParamError' with message 'There is no session matching this name (null for default session): NULL' in /var/www/apache2/html/opengoo/environment/classes/logger/Logger.class.php:83\nStack trace:\n#0 /var/www/apache2/html/opengoo/init.php(156): Logger::log(Object(DBQueryError), 4)\n#1 /var/www/apache2/html/opengoo/index.php(9): require('/var/www/apache...')\n#2 {main}\n  thrown in /var/www/apache2/html/opengoo/environment/classes/logger/Logger.class.php on line 83

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: DB corrupted?
« Reply #1 on: October 12, 2008, 07:30:33 pm »
Hi woland! Thanks for reporting the bug.

Try setting the DEBUG config option to true on config/config.php. This should solve the error that you saw, and if there's another underlying error it should give more info about it on cache/log.php. Please let us know what you find out.

Thanks.

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
Re: DB corrupted?
« Reply #2 on: October 12, 2008, 11:59:09 pm »
Thank you!
Yesterday I reinstall system again to 0.9.1. If this bug appears, i will do as you suggest.

shriram

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: DB corrupted?
« Reply #3 on: October 13, 2008, 06:15:55 am »
I had similar proble and it started once we did the siad chnage son the config file , but later it stated this error Fatal error: Call to undefined function mb_substr() in C:\Apache2\htdocs\opengoo\application\helpers\format.php on line 157

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
Re: DB corrupted?
« Reply #4 on: October 13, 2008, 10:24:55 am »
Yes! This bug appears again in 0.9.1. Debug message:

Query failed with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND show_in_parents = 1) ORDER BY updated_on DESC LIMIT 0, 5' at line 1'
Error params:
File:    /var/www/apache2/html/opengoo/environment/library/database/adapters/AbstractDBAdapter.class.php
Line:    371
Sql:    SELECT * FROM `og_project_charts` WHERE (project_id in () AND show_in_parents = 1) ORDER BY updated_on DESC LIMIT 0, 5
Error number:    1064
Error message:    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND show_in_parents = 1) ORDER BY updated_on DESC LIMIT 0, 5' at line 1
Backtrace:
#0 /var/www/apache2/html/opengoo/environment/library/database/adapters/AbstractDBAdapter.class.php(289): AbstractDBAdapter->prepareAndExecute('SELECT * FROM `...', NULL)
#1 /var/www/apache2/html/opengoo/environment/library/database/DB.class.php(194): AbstractDBAdapter->executeAll('SELECT * FROM `...', NULL)
#2 /var/www/apache2/html/opengoo/environment/classes/dataaccess/DataManager.class.php(182): DB::executeAll('SELECT * FROM `...')
#3 /var/www/apache2/html/opengoo/application/models/project_charts/base/BaseProjectCharts.class.php(109): DataManager->find(Array)
#4 /var/www/apache2/html/opengoo/environment/classes/dataaccess/DataManager.class.php(210): BaseProjectCharts->find(Array)
#5 /var/www/apache2/html/opengoo/application/models/project_charts/base/BaseProjectCharts.class.php(126): DataManager->findAll(Array)
#6 /var/www/apache2/html/opengoo/application/models/project_charts/base/BaseProjectCharts.class.php(128): BaseProjectCharts->findAll(Array)
#7 /var/www/apache2/html/opengoo/application/controllers/DashboardController.class.php(56): BaseProjectCharts->findAll(Array)
#8 /var/www/apache2/html/opengoo/environment/classes/controller/Controller.class.php(69): DashboardController->index()
#9 /var/www/apache2/html/opengoo/environment/classes/controller/PageController.class.php(62): Controller->execute('index')
#10 /var/www/apache2/html/opengoo/environment/classes/Env.class.php(152): PageController->execute('index')
#11 /var/www/apache2/html/opengoo/init.php(150): Env::executeAction('dashboard', 'index')
#12 /var/www/apache2/html/opengoo/index.php(9): require('/var/www/apache...')
#13 {main}
Autoglobal varibles:
$_GET:    
$_POST:    
$_COOKIE:    Array (
  ['id'] => (string) '3'
  ['token'] => (string) '1aea3186c9977ca42fbaffc3ffab90dccefe467e'
  ['PHPSESSID'] => (string) 'hdtu2q15hr20jro1rt1nk9mgmv3e8d41'
)
$_SESSION:    Array (
  ['cal_version'] => true
  ['cal_month'] => (string) '10'
  ['cal_year'] => (string) '2008'
  ['cal_day'] => (string) '13'
)
Execution time:
Total execution time: 0.102486 seconds

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: DB corrupted?
« Reply #5 on: October 13, 2008, 01:04:35 pm »
Can you tell us more info about the context at what this happens? Are you logged in as an administrator or as a regular user? What were you doing when this came up?

Thanks.

xtender

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: DB corrupted?
« Reply #6 on: October 13, 2008, 01:14:36 pm »
2shriram: imho, you have to install extention mb_strings

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
Re: DB corrupted?
« Reply #7 on: October 14, 2008, 07:34:32 am »
Good day to all.

I think (but not sure) this happens after my games with user permissions under admin user. Then I try to login as such user and after login/pass screen I see blank screen. Browser says "Done".

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: DB corrupted?
« Reply #8 on: October 14, 2008, 09:19:10 am »
That may happen if you take away all permissions to workspaces from a user.

Here's an ugly patch, that is in no way a solution to the problem, but will prevent the error message from showing, in case someone can't work due to this problem.

In environment/classes/dataaccess/DataManager.class.php, in function 'find' (around line 164), change the line that reads:

Code: [Select]
$where_string = trim($conditions) == '' ? '' : "WHERE $conditions";
to:

Code: [Select]
$where_string = trim($conditions) == '' ? '' : "WHERE " . preg_replace('/\s+in\s+\(\s*\)/i', ' in (-1) ', $conditions);

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
Re: DB corrupted?
« Reply #9 on: October 14, 2008, 11:54:44 am »
Hi
To any workspace? Or to some exact workspace?
Thanks for patch, I will use it.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: DB corrupted?
« Reply #10 on: October 14, 2008, 01:11:39 pm »
I'm not sure what the cause is, I would be very glad if you could help me figure out how to reproduce it.

Thanks.

msauter

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: DB corrupted?
« Reply #11 on: October 21, 2008, 03:43:38 pm »
I had the same problem (OpenGoo 0.9.1, for a description see http://forums.opengoo.org/index.php?topic=272.msg1050#msg1050)

The hack mentioned above let's you log into your OpenGoo installation again and retrieve your data, but the workspaces don't show up in the left sidebar as they sould... :-(

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: DB corrupted?
« Reply #12 on: October 21, 2008, 05:23:18 pm »
You should login with an admin and give the user permissions to the workspaces again.

If you want/need to play with SQL you can assign a user to all workspaces with this query:

Code: [Select]
INSERT INTO og_project_users
        (project_id, user_id, created_on, created_by_id,
        can_read_messages, can_write_messages, can_read_tasks, can_write_tasks,
        can_read_milestones, can_write_milestones, can_read_files, can_write_files,
        can_read_events, can_write_events, can_read_weblinks, can_write_weblinks,
        can_read_mails, can_write_mails, can_read_contacts, can_write_contacts,
        can_read_comments, can_write_comments, can_assign_to_owners, can_assign_to_other)
    SELECT id, <user's id>, '2008-10-21', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 FROM og_projects;

replacing <user's id> with the id of the user you want to have permissions on all workspaces (the admin user's id is 1). You can see all user ids with a:

Code: [Select]
SELECT id, username FROM og_users;

Bugs can be annoying, huh?

msauter

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: DB corrupted?
« Reply #13 on: October 28, 2008, 06:28:44 pm »
Thanks, but it didn't solve the problem:

After logging in I can only see the "All" workspace. I can reassign myself (= administrator) to the existing workspaces, but
a) the hierarchy has gone (and a can't assign a parent workspace anymore)
b) after logging out and logging in again, all workspaces have gone again.

Looks bad, doesn't it?

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: DB corrupted?
« Reply #14 on: October 29, 2008, 04:59:14 pm »
It should be solved in 1.0RC1
Marcos