Open
Description
Hi.
Getting a really strange error in development in my docker Debian container, on Mac OS X (M3: arm), but not in production on my Linux VM in cloud-land (also running in Docker via Kamal)
Error:
# Running straight in Mac
welcome_message = Rails.cache.fetch("welcome_message1", expires_in: 1.minute) { "Welcome to Rails !" }
Cache read: development:welcome_message1 ({max_age: 2592000, namespace: "development", max_size: 25769803776, compress: true, compress_threshold: 1024, expires_in: 1 minute})
Arel::BindError: wrong number of bind variables (1 for 0) in: "SELECT\n \"solid_cache_entries\".\"key\"\n ,\"solid_cache_entries\".\"value\"\n FROM\n \"solid_cache_entries\"\n WHERE\n \"solid_cache_entries\".\"key_hash\" IN (\n 1111\n ,2222\n )"
from /Users/konung/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/activerecord-8.0.1/lib/arel/nodes/bound_sql_literal.rb:17:in 'Arel::Nodes::BoundSqlLiteral#initialize'
# Running in container - same thing
welcome_message = Rails.cache.fetch("welcome_message1", expires_in: 1.minute) { "Welcome to Rails !" }
Cache read: development:welcome_message1 ({max_age: 2592000, namespace: "development", max_size: 25769803776, compress: true, compress_threshold: 1024, expires_in: 1 minute})
Arel::BindError: wrong number of bind variables (1 for 0) in: "SELECT\n \"solid_cache_entries\".\"key\"\n ,\"solid_cache_entries\".\"value\"\n FROM\n \"solid_cache_entries\"\n WHERE\n \"solid_cache_entries\".\"key_hash\" IN (\n 1111\n ,2222\n )"
from /usr/local/lib/ruby/gems/3.4.0/gems/activerecord-8.0.1/lib/arel/nodes/bound_sql_literal.rb:17:in 'Arel::Nodes::BoundSqlLiteral#initialize'
- Rails.cache.write works fine. Rails.cache.read is what breaking.
- Works in production , but not dev ( as you can see from example, tried both in docker container, and natively on macosx)
- Rails.cache in DEV - works with memory_store, but not sqlite3
- I'm using PostgreSQL as app DB, but using sqlite for caching, both in Prod and Dev.
- Tried already, deleting my storage/development_cache.sqlite3, resetting db, and retuning migrations. Tables are created but cache breaks on reading. (see below)
- Here is my config for both prod and dev straight from console.
- Using Rails 8.0.1 and SolidCache 1.0.6 both in prod and dev.
- Already rebuilt my docker images on my laptop, and restarted docker and laptop.
SolidCache::Entry.connection.instance_variable_get(:@config)
=> {adapter: "sqlite3",
database: "/rails/storage/development_cache.sqlite3",
migrations_paths: "db/cache_migrate",
pool: 20,
timeout: 5000,
strict: true}
SolidCache::Entry.connection.instance_variable_get(:@config)
=>
{:adapter=>"sqlite3",
:database=>"/rails/storage/production_cache.sqlite3",
:pool=>5,
:timeout=>5000,
:prepared_statements=>false,
:strict=>true}
welcome_message = Rails.cache.write("welcome_message1", expires_in: 1.minute) { "Welcome to Rails !" }
Cache write: development:welcome_message1 ({max_age: 2592000, namespace: "development", max_size: 25769803776, compress: true, compress_threshold: 1024})
SolidCache::Entry Upsert (0.8ms) INSERT
INTO
"solid_cache_entries" ("key","value","key_hash","byte_size","created_at")
VALUES (
x '646576656c6f706d656e743a77656c636f6d655f6d65737361676531'
,x '001101000000000000f0bfffffffff04087b063a0f657870697265735f696e6f3a1c416374697665537570706f72743a3a4475726174696f6e083a0b4070617274737b063a0c6d696e7574657369063a0b4076616c756569413a0e407661726961626c6546'
,-4704374427135309031
,269
,STRFTIME (
'%Y-%m-%d %H:%M:%f'
,'NOW'
)
)
ON CONFLICT ("key_hash") DO UPDATE
SET
"key" = excluded. "key","value" = excluded. "value","byte_size" = excluded. "byte_size" RETURNING "id"
true
[8] pry(main)> SolidCache::Entry.all
SolidCache::Entry Exists? (0.4ms) SELECT
1 AS one
FROM
"solid_cache_entries" LIMIT ? [["LIMIT", 1]]
SolidCache::Entry Load (0.2ms) SELECT
"solid_cache_entries" . *
FROM
"solid_cache_entries"
[
[0] #<SolidCache::Entry:0x000000014fb9d430> {
:id => 1,
:key => "development:welcome_message",
:value => "\x00\x11\x01\x00\x00\x00\x00\x00\x00\xF0\xBF\xFF\xFF\xFF\xFF\x04\b{\x06:\x0Fexpires_ino:\x1CActiveSupport::Duration\b:\v@parts{\x06:\fminutesi\x06:\v@valueiA:\x0E@variableF",
:created_at => 2025-01-15 23:21:38.329000000 CST -06:00,
:key_hash => 7666246545949498478,
:byte_size => 268
},
[1] #<SolidCache::Entry:0x000000014fb508d8> {
:id => 2,
:key => "development:welcome_message1",
:value => "\x00\x11\x01\x00\x00\x00\x00\x00\x00\xF0\xBF\xFF\xFF\xFF\xFF\x04\b{\x06:\x0Fexpires_ino:\x1CActiveSupport::Duration\b:\v@parts{\x06:\fminutesi\x06:\v@valueiA:\x0E@variableF",
:created_at => 2025-01-15 23:35:55.827000000 CST -06:00,
:key_hash => -4704374427135309031,
:byte_size => 269
}
]
Metadata
Metadata
Assignees
Labels
No labels