I am a journal manager and currently, when adding Announcements, we receive the message: “DB Error: Commands out of sync; you can’t run this command now.” We don’t know why we’re getting the message, but the Announcement posts just fine. How do I fix this?
I haven’t seen that message before – but before debugging this in depth, I’d suggest upgrading to a more recent release. OJS 2.4.4-1 is quite old, and it’s not unlikely that the problem is resolved in more recent releases.
Public Knowledge Project Team
@asmecher We get this same message (on white screen) in OJS 3.1.2 when trying to start the QuickSubmit plugin if there was some other database activity before that. And if we clear the three caches from the Admin menu, the message is gone and the plugin can be used normally. Another strange detail is that the message is preceded by “ojs2:” although it’s a clean OJS3 installation.
Is there any quick fix for this? Having to clean the caches all the time is getting annoying.
@asmecher I set it on and did the same things in order to trigger the error. There is no more white screen and the associated error (reported in this ticket’s title), but there’s a bunch of new Fatal Errors in log file:
PHP Fatal error: Class 'ADORecordSet_empty' not found in /journal/lib/pkp/controllers/page/PageHandler.inc.php on line 32
ojs2: DB Error: Commands out of sync; you can't run this command now
PHP Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0
Strangely though, both the site’s backend and frontend work normally despite all these Fatal Errors - how can that be?!
Also: each time QuickSubmit plugin is fired, a submission is started under the Submissions, and a new submission number reserved/taken permanently in the database. Deleting these bogus submissions takes a lots of time when entering entire volumes (not to mention that it’s burdensome on the database since it creates bogus permanent entries all the time), so is there a quick fix for that also? Surely we don’t need a new-submission entry recorded each time QuickSubmit plugin is accessed (clicked within the backend’s menu).
Perhaps this will help (if I remember it correctly, this started after installing the QuickSubmit plugin): whenever I access the Issues menu option in the backend (either of the submenu options: Future Issues, or Back Issues), the Payments submenu on mouseover looks like so:
and immediately upon switching to any other menu option (for example: Administration, as in the image below), it starts displaying the payment options on mouseover normally - without the need to clean any caches (OJS’s or browser’s):
This sounds a lot like a database server issue which is cascading down into PHP. The backend and frontend functionality may appear ok if these errors are only causing failed AJAX calls which aren’t directly affecting the UI. Presumably, a PHP Fatal will result in a HTTP 500 error. If you are comfortable using the browser’s Web Inspector, you can see exactly which calls are failing.
Within the community forum, we try to encourage everyone to participate in the discussions where they have knowledge and interest. There are many core contributors to PKP, and we will all contribute whenever we can.
Beyond that general rule, asmecher will be largely unavailable for the next week or two.
I’m looking primarily at the message DB Error: Commands out of sync; you can't run this command now. This is a database error being thrown to OJS. It is plausible that OJS is triggering this by simultaneous queries within the mysqli driver, but if it is an OJS bug, it seems to be very dependent on some unusual external criteria.
What database driver do you have set in config.inc.php and what database system do you use for your OJS database? What OS platform are you running this under?
As asmecher mentioned earlier, the best way to find this error will likely be to see a full stack trace for each of these error messages.
Actually, clearing of caches takes care of that DB error too. As you can see in this thread, others have reported the same error but as related to Announcements, not the QuickSubmit plugin. So the issue seems with the way OJS3 sets cookies, as with many other errors due to OJS3 cookies bug.
All config.in.php settings are OJS3 default. Server configuration and database are all standard, as in 90% users/configurations: Apache, PHP7, etc.
The above errors are from the stack trace in error.log file which started recording the stack trace since show_stacktrace in config.inc.php was turned On per @ asmecher’s advice (it’s also when the white screen (error 500) stopped occurring.)
A stack trace will include all of the function calls leading up to the error, which is why it is helpful for debugging. You can see an example of what one looks like here:
If you can share the stack trace, this will help us to identify the error.
There really is no such thing as a “standard” configuration. Every server has a specific combination of Apache version, PHP version, Database server, and OS version. This specific combination is important for us to know when a bug is found. For example, I’m not able to reproduce this under Red Hat Enterprise Linux Server release 7.6 (Maipo) with Apache 2.4.6, PHP 7.2.14, and the mysqli driver against Ver 15.1 Distrib 5.5.60-MariaDB.
Can you share a link to “OJS3 cookies bug”? Note that only the “Expire User Sessions” option under the Administration menu relates to OJS cookies. Does the problem resolve if you only Expire User Sessions and do not run the Clear Data Cache and Clear Template Cache options?
So the “DB Error” is gone from the logs as well now? This is what I was hoping to get a stack trace on. Even if you don’t see a white screen, a failed AJAX request would still result in a stack trace recorded in the log.
Again, the DB error is gone from the screen as there’s no more white screen (error 500), and it remains (still appears when triggered) in the error.log only.
The first PHP version is the server’s version (as with all other stated settings). The second one is the domain’s PHP version as set in the MultiPHP Manager of Control Panel 80.0 (build 22). It can be set up to 7.3 and can be different for different domains and subdomains.