DEV Community

loading...

Discussion on: Rails quick tips #1: Console sandbox

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
citizen428 profile image
Michael Kohl Author

Good point! To be honest I never even thought about someone using this on a production app :O

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 😭

Forem Open with the Forem app