DEV Community

[Comment from a deleted post]
Collapse
 
dwilkins profile image
David H. Wilkins

Yes, --sandbox is very handy, but I cringe every time I see someone use it on a production system.

Sandbox mode doesn't just rollback, it creates an enclosing transaction for all of the commands you do while in that instance of the console. If you change database rows in that transaction, updates to the tables and rows affected can block for other users. This can cause lockups for other users if used in production.

Any rails console actions on production should be done carefully, and should (IMHO) never use --sandbox. Sandbox mode is really useful for development and other non-critical systems.

Collapse
 
captainawesomedi profile image
Di Wu

I wish I read your comments earlier today. I was testing out something in sandbox in product apparently triggered something recursive locked all records and Database cpu usage was 100%. Our application was down for 30-45 minutes. It recovered till someone restart the database instance 😭