ruby on rails - Bizarre ActiveRecord issues - like generating invalid SQL -


recently deployed new version of our app, , since we've been seeing weird issues activerecord. example, here's snippet of query generates hundreds of times per day, correctly:

`entries`.`style` t1_r25, `entries`.`pdf_visibility`       , `entries`.`web_visibility` t1_r27 

that's not typo, t1_r26 missing there although there's space should be. 1 time. that's not hand-written sql, either, that's activerecord writing query , deciding on placeholder variables. has botched other queries leaving things blank shouldn't blank (shouldn't possible), once in while. of time it's fine.

we're seeing lot of instances complains things table_alias or reflection being undefined variable or method on false:falseclass. that's true...but thing falseclass should have been activerecord model. have no clue how of happening, or how possibly have written bug in our rails code of (especially invalid query above).

we're on rails 4.1.16 (we upgraded 4.1.8 when started happening) ruby 2.2.0 in passenger 5.0.26 (going 5.0.30 next). these errors extremely sporadic , none of them make sense. out of thousands of requests per day, small handful of them (less 10 across 5 servers) result in 1 of these weird errors, , can't purposely reproduce of them.

my entire team stumped. we've spent hours poring on code changes , can't see might cause of this. don't know possibly have written cause activerecord write bad query in way shouldn't able affect. have no idea how begin troubleshooting kind of thing. out there have hint might point in useful direction?

update: here's new 1 threw morning. note libraryitem 1 of our pretty straightforward activerecord models:

nomethoderror: undefined method `__callbacks' #<libraryitem:0x007f66cc5b82b0> 

i...have no idea.

to close loop tried , stumbles this: cured upgrading mri. we'd been running on 2.2.0 around year, why didn't suspect it, , because started particular deployment. tipped off when saw couple of errors inability allocate memory, , when mri exploded in hail of shrapnel on 1 server (by mean segfaulted) , took passenger down it.

from there started looking @ mri changelogs , noticed ton of memory , gc related bug fixes between 2.2.0 , 2.2.5. last night upgraded 2.2.5 deployment, , (fingers crossed) haven't seen single 1 of these weird issues yet. (previously seeing 12-20 per day or more, depending on traffic).

so, why did start happening following deployment us? don't know sure, have guess: i'm thinking size in bytes of our application in memory hit critical mass @ started triggering 1 or more of mri bugs fixed between 2.2.0 , 2.2.5. best can come with.

huge stepped in try assist!


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -