Tiny Tiny RSS: Community

[fixed][pdo-experimental] - Call to a member function rowCount() on a non-object


#1

Version:

-bash-4.1$ git pull -vu
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 10 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (10/10), done.
From https://git.tt-rss.org/git/tt-rss
 = [up to date]      jsonfeed-test-branch -> origin/jsonfeed-test-branch
 = [up to date]      master     -> origin/master
   0518510..99b23da  pdo-experimental -> origin/pdo-experimental
Updating 0518510..99b23da
Fast-forward
 classes/opml.php      |    2 +-
 include/functions.php |    8 ++++----
 index.php             |    4 ++--
 prefs.php             |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

I appear to have a problem with pdo-experimental (I’ve recently changed the purge default from disabled to something more reasonable than ‘forever’ if it matters):

-bash-4.1$ /usr/bin/php /var/www/vhosts/shabble.co.uk/httpdocs/reader2/update.php --feeds
[17:01:18/26437] Lock: update.lock
[17:01:18/26437] Scheduled 0 feeds to update...
[17:01:18/26437] Sending digests, batch of max 15 users, headline limit = 1000
[17:01:18/26437] All done.
[17:01:18/26437] cache/simplepie: removed 0 files.
[17:01:18/26437] cache/feeds: removed 0 files.
[17:01:18/26437] cache/images: removed 0 files.
[17:01:18/26437] cache/export: removed 0 files.
[17:01:18/26437] cache/upload: removed 0 files.
[17:01:18/26437] Removed 0 old lock files.
[17:01:18/26437] Removing old error log entries...
[17:01:18/26437] Feedbrowser updated, 150 feeds processed.
PHP Fatal error:  Call to a member function rowCount() on a non-object in /var/www/vhosts/shabble.co.uk/httpdocs/reader2/classes/article.php on line 911

Same command on master doesn’t error:

-bash-4.1$ /usr/bin/php /var/www/vhosts/shabble.co.uk/httpdocs/reader/update.php --feeds
[17:02:00/26441] Lock: update.lock
[17:02:00/26441] Scheduled 0 feeds to update...
[17:02:00/26441] Sending digests, batch of max 15 users, headline limit = 1000
[17:02:00/26441] All done.
[17:02:00/26441] cache/simplepie: removed 1 files.
[17:02:00/26441] cache/images: removed 0 files.
[17:02:00/26441] cache/export: removed 0 files.
[17:02:00/26441] cache/upload: removed 0 files.
[17:02:00/26441] Removed 0 old lock files.
[17:02:00/26441] Removing old error log entries...
[17:02:00/26441] Feedbrowser updated, 150 feeds processed.
[17:02:07/26441] Purged 1 orphaned posts.
[17:02:07/26441] Removed 0 (feeds) 0 (cats) orphaned counter cache entries.
-bash-4.1$

I will note, however, that running that command on master continues to say it’s Purged 1 orphaned posts even after repeating the command numerous times…


Archiving/splitting the database
#2

why not post in the main thread? where are the actual errors?

e: ffs i barely figured out that triangle thing

e2: check for SQL query errors either in system tab in preferences or your https log, without an actual database error it’s impossible to figure out what’s wrong.

the query in question hasn’t changed in any way so idk why it could fail. it works fine on both pgsql and mysql here.


#3

Thought it would get lost among the general noise, and when this gets sorted it’ll drop off the recent list to be forgotten about.

Didn’t think to look there, since it was PHP throwing errors about objects, not MySQL about queries - think I found the problem though:

PDO::query(): SQLSTATE[HY000]: General error: 1206 The total number of locks exceeds the lock table size

I’l get that sorted first.


#4

so much noise, like 1 post a day lol

anyway, this sounds like screwed up database (?), however it probably be a good idea to limit this query somehow. i have no idea if it’s possible to do delete … limit.


#5

It is - it’s how I fixed the problem - it was trying to delete a stupid (my fault) number of rows. Then restarted mysql.


#6
mysql> select count(*) FROM ttrss_entries WHERE NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id);
+----------+
| count(*) |
+----------+
|   146079 |
+----------+
1 row in set (0.87 sec)

mysql> DELETE FROM ttrss_entries WHERE NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id)
    -> limit 10000;
Query OK, 10000 rows affected (2.94 sec)

mysql> DELETE FROM ttrss_entries WHERE NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) limit 10000;
Query OK, 10000 rows affected (5.02 sec)

mysql> DELETE FROM ttrss_entries WHERE NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) limit 10000;
Query OK, 10000 rows affected (7.52 sec)

[etc.]

Probable causes were a combination of

  1. My setting Purge articles after ... to 300 when it was 0 to start with (been running for a few years.)
  2. Deleting some old feeds that were now dead and returning errors.

#7

i’ll add a reasonable limit to this query then, it makes sense anyway.

e: postgresql doesn’t like this syntax :frowning:

mysql> DELETE FROM ttrss_entries WHERE id IN ( SELECT id FROM ttrss_entries  WHERE NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) LIMIT 5000)
    -> ;
ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

oh jesus almighty kill me now


#8

Probably a silly question, but why

delete from (select from (select...) limit 5000)

instead of

delete from (select...) limit 5000

?

(And your complaint mentions postgres, but the error appears to be from mysql)


#9

because this is mysql-specific syntax, postgres doesn’t like it

well then i attempted to rewrite it in something approaching standard sql but lol nope