Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix users_db_security.js delete/recreate _users DB #1238

Closed
wohali opened this issue Mar 26, 2018 · 16 comments · Fixed by #1258
Closed

Fix users_db_security.js delete/recreate _users DB #1238

wohali opened this issue Mar 26, 2018 · 16 comments · Fixed by #1258
Assignees
Milestone

Comments

@wohali
Copy link
Member

wohali commented Mar 26, 2018

We got a random failure in Jenkins related to encryption:

https://builds.apache.org/blue/organizations/jenkins/CouchDB/detail/master/223/pipeline

Logs at https://couchdb-vm2.apache.org/ci_errorlogs/jenkins-couchdb-223-2018-03-23T23:15:34.663810/couchlog.tar.gz

test/javascript/tests/users_db_security.js                     
    Error: undefined
Trace back (most recent call first):
    
  52: test/javascript/test_setup.js
      T((void 0))
  35: test/javascript/tests/users_db_security.js
      ("jchris1")
  39: test/javascript/tests/users_db_security.js
      ([object Object],"org.couchdb.user:fdmanana","jchris1")
 168: test/javascript/tests/users_db_security.js
      ("pbkdf2",(function (derived_key) {TEquals(40, derived_key.length, "de
 413: test/javascript/tests/users_db_security.js
      ()
 395: test/javascript/couch_test_runner.js
      run_on_modified_server([object Array],(function () {try {testFun(schem
 411: test/javascript/tests/users_db_security.js
      ("pbkdf2",0,[object Array])
 399: test/javascript/tests/users_db_security.js
      ()
  37: test/javascript/cli_runner.js
      runTest()
  48: test/javascript/cli_runner.js

@eiri says:

I looked into it and as far as I can see with bcrypt PR API test users_db_security.js was changed to be prune to racing condition - user database got deleted and re-created, which is known anti-pattern.

@wohali wohali added this to the 2.2.0 milestone Mar 27, 2018
@eiri eiri self-assigned this Mar 27, 2018
@eiri
Copy link
Member

eiri commented Mar 27, 2018

Taking this for a fix, it breaks every third travis run. 😠

@wohali
Copy link
Member Author

wohali commented Mar 28, 2018

Thanks @eiri, was going to get to it tomorrow if you didn't.

@janl
Copy link
Member

janl commented Mar 28, 2018

I’m having a stab at it at the moment.

@eiri
Copy link
Member

eiri commented Mar 28, 2018

@janl ok, I'll stop my work and switch to something different. Was self-assignment on this case not sufficient to indicate I'm already working on it?

@janl
Copy link
Member

janl commented Mar 28, 2018

@eiri sorry, I thought your clock ran out and the end of your day yesterday :/

janl added a commit to janl/couchdb that referenced this issue Mar 28, 2018
Closes apache#1238

1. log errors from waitForSuccess
2. log errors in testFun()
3. spinloop replaces arbitrary wait timeout
@janl
Copy link
Member

janl commented Mar 28, 2018

@eiri I felt a bit over-eager because I had approved this PR and I should have caught the issue on review.

@janl
Copy link
Member

janl commented Mar 28, 2018

Closing this in favour of #1250. Apologies again for the toe-stepping.

@janl janl closed this as completed Mar 28, 2018
@eiri
Copy link
Member

eiri commented Mar 28, 2018

@janl No worries, it's actually my bias of assuming me been online miracly obvious to everyone and I do seat in a weird timezone. Sorry this came across that grouchy.

janl added a commit that referenced this issue Mar 28, 2018
Closes #1238

1. log errors from waitForSuccess
2. log errors in testFun()
3. spinloop replaces arbitrary wait timeout
@janl
Copy link
Member

janl commented Mar 28, 2018

All good :)

@wohali
Copy link
Member Author

wohali commented Mar 28, 2018

@janl Your fix failed on Jenkins, reopening :(

https://builds.apache.org/blue/organizations/jenkins/CouchDB/detail/master/231/pipeline

test/javascript/tests/users_db_security.js                     
    Error: undefined
Trace back (most recent call first):
    
  52: test/javascript/test_setup.js
      T((void 0))
  35: test/javascript/tests/users_db_security.js
      ("jchris")
  39: test/javascript/tests/users_db_security.js
      ([object Object],"org.couchdb.user:jchris","jchris")
 111: test/javascript/tests/users_db_security.js
      ("bcrypt",(function (derived_key) {TEquals(60, derived_key.length, "de
 413: test/javascript/tests/users_db_security.js
      ()
 395: test/javascript/couch_test_runner.js
      run_on_modified_server([object Array],(function () {try {testFun(schem
 411: test/javascript/tests/users_db_security.js
      ("bcrypt",1,[object Array])
 399: test/javascript/tests/users_db_security.js
      ()
  37: test/javascript/cli_runner.js
      runTest()
  48: test/javascript/cli_runner.js
      
fail

https://couchdb-vm2.apache.org/ci_errorlogs/jenkins-couchdb-231-2018-03-28T17:21:43.727450/couchlog.tar.gz

@wohali wohali reopened this Mar 28, 2018
@janl
Copy link
Member

janl commented Mar 29, 2018

on it

@janl
Copy link
Member

janl commented Mar 29, 2018

Two points:

  1. we are in dire need of rewriting this test file
  2. it might be that this failure points to pbkdf not working as we expect it to for config admins. I’ll keep investigating.

@janl janl assigned janl and eiri and unassigned eiri Mar 29, 2018
@eiri
Copy link
Member

eiri commented Mar 29, 2018

  1. Totally agree, this test and the whole javascript suite are really hard to follow. It'd be amazing to revive Russel's suggestion to migrate it to Elixir.

  2. I think it's not that pbkdf or bcrypt don't work as expected, but rather hashing on heavily restricted CI hosts is not able to complete within 5 sec

In the logs from the failed jenkins' test I found:

[notice] 2018-03-28T17:21:33.282844Z [email protected] <0.32515.3> a82be2eaf1 127.0.0.1:15984 127.0.0.1 undefined PUT /_users/org.couchdb.user%3Ajchris 201 ok 511
[warning] 2018-03-28T17:21:38.285265Z [email protected] <0.32515.3> 59932a5bfc couch_httpd_auth: Authentication failed for user jchris from 127.0.0.1
[notice] 2018-03-28T17:21:38.285724Z [email protected] <0.32515.3> 59932a5bfc 127.0.0.1:15984 127.0.0.1 undefined POST /_session 401 ok 2

And when I insert something like

    if (scheme == "bcrypt") {
      wait(500);
    }
    else {
      wait(5000);
    }

at line 110 of users_db_security.js I'm getting the same failure and stack trace.

@janl
Copy link
Member

janl commented Mar 29, 2018

s/pbkdf/bcrypt/ apologies

@janl
Copy link
Member

janl commented Mar 29, 2018

This is it, we need to send log_rounds to 1 as well

@janl
Copy link
Member

janl commented Mar 29, 2018

Fixed in #1258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants