Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:37:49+00:00 2026-06-18T15:37:49+00:00

I have a Rails 3 app that inserts user inputs into the the database.

  • 0

I have a Rails 3 app that inserts user inputs into the the database.

Every time a user clicks the submit button, all fields(name, email, phone number, etc) will be inserted into the database. But what if two users submit the form at the EXACT same time, will the database run into a deadlock state?

I found that rails 3 has a threaded mode which is to change config.threadsafe! in production.rb. But I am not sure whether this will also take care of the database deadlock problem.

Is there a way to resolve or avoid this?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:37:50+00:00Added an answer on June 18, 2026 at 3:37 pm

    At the database level, there is no danger that the Database will enter deadlocked state. Databases like MySQL are extremely robust, and even 1000s of updates per second will not result in a deadlock.

    However, it might be worth using Active Record’s Optimistic locking support to alert the second user that the record has changed since they started editing it.

    The following example from the above linked documentation should help explain this:

    p1 = Person.find(1)
    p2 = Person.find(1)
    
    p1.first_name = "Michael"
    p1.save
    
    p2.first_name = "should fail"
    p2.save # Raises a ActiveRecord::StaleObjectError
    

    As an aside config.threadsafe! is used to configure compatible servers that they can use threaded-concurrency to server requests, rather than the more-common-to-Rails process concurrency. Aaron Patterrson has a writeup on threadsafe! that’s worth reading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails app that needs to expose values from a database as
I have a web frontend based on a Ruby On Rails app that inserts
I have a rails 3 app that grabs a 'post' via ajax and inserts
I have a Rails app that is served by Apache and Passenger, using only
I have a Rails app that does everything I need it to do via
I have a rails app that is using Devise perfectly in development. I have
I have a rails app that has asynchronous processing, and I'm having trouble getting
I have a Rails app that archives high-res images (and thumbs) on S3 (via
We have a Rails app that instantiates a SWF object 16 times (it has
I have a rails app that I'm moving to another server and I figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.