Internal Server Error Mysql2::Error: Lock wait timeout exceeded; try restarting transaction

Hey all,

When running a cucumber test, I get this:

Internal Server Error
Mysql2::Error: Lock wait timeout exceeded; try restarting transaction:
INSERT INTO users (address_1, address_2, address_3,
can_receive_sms, city, completed_terms_on, country_id,
created_at, current_sign_in_at, current_sign_in_ip,
department, email, encrypted_password, fax, first_name,
force_update_password, gender_id, invitation_accepted_at,
invitation_limit, invitation_sent_at, invitation_token,
invited_by_id, invited_by_type, last_name, last_sign_in_at,
last_sign_in_ip, middle_initial, mobile_phone, notes,
organization_id, organization_type, postal_code,
remember_created_at, reset_password_sent_at,
reset_password_token, sign_in_count, state_region, timecop,
timezone, title, tmp_password, user_state_id, user_type_id,
username, work_phone) VALUES (’’, ‘’, ‘’, 0, ‘’, NULL, 1,
‘2012-01-19 23:26:32’, NULL, NULL, ‘’, ‘[email protected]’, ‘$5a
$02$1/mAgbgewxsVz8MLh0B4ievdEeyASECbjMgCSAPwfv294MJUMwg0S’, NULL,
‘user1’, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ‘user1’, NULL,
NULL, ‘’, ‘’, ‘’, 1, ‘Client’, ‘’, NULL, NULL, NULL, 0, ‘’, 0,
‘America/New_York’, ‘’, ‘ADFCGCJ’, 3, NULL, ‘user1’, ‘0432156789’)

The test fails on this method:

def create_user(roles)



click_link 'Users'

click_on 'New User'

role = Role.find_by_key(roles)
user = Factory.create :user, force_update_password: true, roles:


site = Factory.create :site, site_state_id:

user.organization = site!

%w{username email first_name last_name work_phone}.each do |field|
  fill_in "user_#{field}", with: user[field]

select_second_group_option 'organization'

if roles.to_s.downcase == "site"

fill_in 'password', with: user.password

select "America/New_York", from: 'user_timezone'
select "#{}", from: 'user_role_ids'
select "USA", from: 'user_country_id'

click_on 'Create User'

return user


I tried the following already:

1)trying dumping and adding new database

  1. tried modifying my.cnf log and added this:

  2. Copying the sql and running it in mysql directly worked fine so not
    a problem with sql itself:
    Query OK, 1 row affected (0.00 sec)

  3. The following gives undefined method for some strange reason (even
    though I copied directions):
    ActiveRecord::Base.verification_timeout = 570

  4. Tried using development database rather than test database

thanks for response

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs