#Getting memory errors when I try to interact with ActiveRecord models

1 messages · Page 1 of 1 (latest)

vivid tree
#

Im getting the following errors when I try to interact with about any model in my app.

ruby(25572,0x1d995dec0) malloc: double free for ptr 0x130011200 ruby(25572,0x1d995dec0) malloc: *** set a breakpoint in malloc_error_break to debug

I dont seem to be getting errors when using basic rails commands just trying to interact with models, here's an example:

Loading production environment (Rails 7.0.8) irb(main):001> Time.zone.now => Tue, 26 Dec 2023 19:55:34.680327000 UTC +00:00 irb(main):002> SecureRandom.hex(8) => "750e8d097402c96a" irb(main):003> Program.first ruby(25696,0x1d995dec0) malloc: double free for ptr 0x115008200 ruby(25696,0x1d995dec0) malloc: *** set a breakpoint in malloc_error_break to debug

The app runs great in development. I've never seen these errors before I don't even know where to start testing.

cerulean kelpBOT
#

Project ID: 04f4c8ba-1da2-48d6-a1fb-ccf7916d1039

vivid tree
#

04f4c8ba-1da2-48d6-a1fb-ccf7916d1039

vivid tree
#

when I try to run railway run rails db:migrate I get an error which looks a little different

ruby(27769,0x1d995dec0) malloc: *** error for object 0x52: pointer being freed was not allocated
ruby(27769,0x1d995dec0) malloc: *** set a breakpoint in malloc_error_break to debug

#

The same command in development runs no problem.

vivid tree
#

ok after a little digging in the logs I discovered the following error:

2023-12-27 03:15:08.891 UTC [100] FATAL: no PostgreSQL user name specified in startup packet

2023-12-27 03:15:08.934 UTC [101] FATAL: no PostgreSQL user name specified in startup packet

I have this in my config/database.yml

production: adapter: postgresql encoding: unicode pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> database: <%= ENV['PGDATABASE'] %> username: <%= ENV['PGUSER'] %> password: <%= ENV['PGPASSWORD'] %> host: <%= ENV['PGHOST'] %> port: <%= ENV['PGPORT'] %>

irb(main):001> ENV['PGUSER'] => "postgres"

at this point Im not sure what to do. I feel like I have all of the credentials set correctly. Also, Im not sure why attempting to run railway run rails db:create would return an error message about memory and the railway logs would have an entirely different error message about a username not being supplied.

hollow nimbus
#

Same issue here 🖐️

production: <<: *default url: <%= ENV['DATABASE_URL'] %>

And the variable is available in the console

vivid tree
#

I think there's an issue with the new Postgres service. Before I switched I was able to perform any migration, now I can't do anything.

#

Also, whats weird is that in Ruby I don't really have access to memory assignemnts. The only thing I can think of would be a gem that uses C functions.

vivid tree
#

I guess none of this really matters, the big issue in my mind is that the railway console returns a different error than the observability layer logs.

vivid tree
#

Just tested this by standing up a Linode server and deploying my app to it. No changes have been made to the app. Everything works great on the linode server, there's no memory allocation errors. Based on the portion of the picture I can see, this seems like an infrustructure issue with Railway.

drowsy quest
#

I'm getting the same error. I have the same settings ans @hollow nimbus

#

I'm trying to run migrations using

railway run bundle exec rake db:migrate RAILS_ENV=production DATABASE_URL="..."

drowsy quest
#

I'm getting the same error running any rake task

drowsy quest
#

please, comment on it and up vote it to bring attention to the problem

drowsy quest
#

This is the output that I'm getting from the observability window:

2024-01-21 04:39:07.326 UTC [4660] FATAL:  no PostgreSQL user name specified in startup packet

2024-01-21 04:39:07.508 UTC [4661] FATAL:  no PostgreSQL user name specified in startup packet