8000 SolidCable querying incorrect database · Issue #63 · rails/solid_cable · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SolidCable querying incorrect database #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joshleblanc opened this issue May 13, 2025 · 2 comments
Open

SolidCable querying incorrect database #63

joshleblanc opened this issue May 13, 2025 · 2 comments

Comments

@joshleblanc
Copy link
joshleblanc commented May 13, 2025

This came up recently, and doesn't actually effect the running application. I don't see any errors in the rails logs, and the application doesn't seem to be effected. Basically, solid_cable is querying the primary database for column information, which is erroring, inflating our postgres log directory.

We've simply turned off postgres logs in the meantime.

Our database.yml is setup as follows:

production:
  primary:
    <<: *default
    url: <%= ENV['PROD_DATABASE_URL'] %>
  cache:
    <<: *default
    adapter: sqlite3
    database: storage/production_cache.sqlite3
    migrations_paths: db/cache_migrate
  cable:
    <<: *default
    adapter: sqlite3
    database: storage/production_cable.sqlite3
    migrations_paths: db/cable_migrate
  queue:
    <<: *default
    adapter: sqlite3
    database: storage/production_queue.sqlite3
    migrations_paths: db/queue_migrate

cable.yml is setup as follows

production:
  adapter: solid_cable
  connects_to:
    database:
      writing: cable
  polling_interval: 0.1.seconds
  message_retention: 1.day

In the postgres logs, the following is printed every ~10th of a second or so. This seems to correspond to the polling_interval.

2025-05-13 11:57:50.043 EDT [13740] ERROR:  relation "solid_cable_messages" does not exist at character 523
2025-05-13 11:57:50.043 EDT [13740] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       c.collname, col_description(a.attrelid, a.attnum) AS comment,
	       attidentity AS identity,
	       attgenerated as attgenerated
	  FROM pg_attribute a
	  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	  LEFT JOIN pg_type t ON a.atttypid = t.oid
	  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
	 WHERE a.attrelid = '"solid_cable_messages"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
	 ORDER BY a.attnum

The problem is that postgres shouldn't be receiving this query at all, this should be relegated to the sqlite3 file.

Perhaps related, but not related to this library, is this also occurs with solid_queue, except on it's recurring polling_interval.

@npezza93
Copy link
Collaborator

What's <<: *default look like in your database.yml file? (without any sensitive info)

@joshleblanc
Copy link
Author
joshleblanc commented May 13, 2025
default: &default
  adapter: postgresql
  encoding: unicode
  # For details on connection pooling, see Rails configuration guide
  # https://guides.rubyonrails.org/configuring.html#database-pooling
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

The adapter key there is meaningless, we can drop it if that's what's causing problems, it's overridden by connection URLs in all environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0