Forums | Mahara Community

Support /
Upgrade 17.10.04 to 18.04 - function StartTrans()


Thomas Gsp's profile picture
Posts: 9

24 May 2018, 20:29

 

Hi,

Thanks you for your help.

function db_begin() {
    global $db;
    log_debug('Am I mysql: ' . is_mysql());
    if (is_mysql()) {
        return;
    }

    $GLOBALS['_TRANSACTION_LEVEL']++;
    $db->StartTrans();
}

 

Result when this error happen:

[Thu May 24 09:20:27.867697 2018] [:error] [pid 14487] [client 193.60.133.195:40844] [DBG] 34 (/var/www/mahara1804/lib/dml.php:1602) Am I mysql: , referer: https://*********.ac.uk/user/view.php?id=56032
[Thu May 24 09:20:27.867784 2018] [:error] [pid 14487] [client 193.60.133.195:40844] PHP Fatal error:  Call to a member function StartTrans() on null in /var/www/mahara1804/lib/dml.php on line 1608, referer: https://***********ac.uk/user/view.php?id=56032

But, i'm surprised. A message should not be present every time when i'm visiting a user profile ?

I have the DBG message every time when StartTrans() fail and sometime just the DBG like this when i'm visiting a profile:

[Thu May 24 09:25:10.226634 2018] [:error] [pid 14487] [client 193.60.133.195:44714] [DBG] 11 (lib/dml.php:1602) Am I mysql: 1, referer: https://*********.ac.uk/user/view.php?id=3729

 

Thomas.

 

Robert Lyon's profile picture
Posts: 749

25 May 2018, 10:51

Hi Thomas,

That is strange - sometimes the site thinks it is MySql and sometimes it doesn't

Can you add below the first log_debug() you added, the following line:

log_debug('DBtype is : |' . get_config('dbtype') . '|');

This way we should be able to see what Mahara thinks is the dbtype at this point in code execution. It should say |mysql|

Cheers

Robert

Thomas Gsp's profile picture
Posts: 9

25 May 2018, 22:27

It's like if there are not database type.

But a new connection with mysql is start just after.

 

[Fri May 25 11:21:49.019394 2018] [:error] [pid 21515] [client 193.60.133.195:52062] [DBG] 76 (/var/www/mahara1804/lib/dml.php:1602) Am I mysql: , referer: https://******.ac.uk/user/view.php?id=63113

[Fri May 25 11:21:49.019511 2018] [:error] [pid 21515] [client 193.60.133.195:52062] [DBG] 76 (/var/www/mahara1804/lib/dml.php:1603) DBtype is : ||, referer: https://******.bcu.ac.uk/user/view.php?id=63113

[Fri May 25 11:21:49.019544 2018] [:error] [pid 21515] [client 193.60.133.195:52062] PHP Fatal error: Call to a member function StartTrans() on null in /var/www/mahara1804/lib/dml.php on line 1609, referer: https://******.ac.uk/user/view.php?id=63113

[Fri May 25 11:21:49.969723 2018] [:error] [pid 21513][client 193.60.133.195:52060] [DBG] 85 (lib/dml.php:1602) Am I mysql: 1, referer: https://*******ac.uk/user/view.php?id=63113

[Fri May 25 11:21:49.969865 2018] [:error] [pid 21513] [client 193.60.133.195:52060] [DBG] 85 (lib/dml.php:1603) DBtype is : |mysqli|, referer: https://******.ac.uk/user/view.php?id=63113

Robert Lyon's profile picture
Posts: 749

28 May 2018, 9:46

Hi Thomas,

That is very strange - so sometimes the dbtype is correctly  seen as 'mysqli' but sometimes not. Is the website somehow load-balanced but the data/config.php is not the same in each server?

That is the only thing I can think of that it is something to do with load-balancing and/or race condition between db server and web server.

Or a badly written, non-core, plugin is doing things in a strange way - is there any custom/third party plugins for the site?

Cheers

Robert

Thomas Gsp's profile picture
Posts: 9

29 May 2018, 18:25

Hi,

There is not load balancing system.

It's a standalone server, dedicated to the updates tests.

I'll check plugins.

Thanks,

Thomas.

15 results