Description:
|
We've seen this problem periodically, and it's 100% reproducible if you have the right mystery-combination of things in your migration and database. It seems more likely when you have multiple long-running commands. Also to the use of:
execute <<-SQL
...
SQL
In the end, rake is just running a few SQL statements over AR/JDBC, so it's inexplicable to me that you could use up your heap. During normal operation there appears to be no leaking at all, and then, suddenly, one statement completes and it happens all at once.
This latest time when I had a migration/DB combo that reliably reproduced it, I hooked up yourkit and captured a dump on the crash.
What I see is once a particular command completes (in this case, the execution of raw SQL), the heap gets blasted sky high hundreds of megabytes of com.mysql.jdbc.ByteArrayRow, containing i.e.
[0] byte[9] = {49, 54, 54, 57, 50, 49, 51, 50, 55}
There are 93,043 such Object[]s with 4,346,584 byte[][] underneath, most like the one above.
Under some circumstance, something is improperly holding onto data coming back from JDBC.
|