Unique constraint violation

Hi,

With a fresh install of Owncloud I do have an issue with I believe OAuth2.

This always is the same user (mac user) that do provoque the following error:

{“reqId”:“ffa48ab4-7eb0-419c-b947-262eb08f2c65”,“level”:3,“time”:“2019-02-16T13:16:23+00:00”,“remoteAddr”:“192.168.1.1”,“user”:“46D3E531-855B-4458-B67A-39D5B47ECA50”,“app”:“OC\User\Session::createSessionToken”,“method”:“PROPFIND”,“url”:"/remote.php/dav/files/46D3E531-855B-4458-B67A-39D5B47ECA50/",“message”:“Exception: {“Exception”:“Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException”,“Message”:“An exception occurred while executing ‘INSERT INTO oc_authtoken(uid,login_name,name,token,type,last_activity,last_check) VALUES(?,?,?,?,?,?,?)’ with params [\“46D3E531-855B-4458-B67A-39D5B47ECA50\”, \“46D3E531-855B-4458-B67A-39D5B47ECA50\”, \“Mozilla\\\/5.0 (Macintosh) mirall\\\/2.5.2 (build 11198)\”, \“f890299b609247757da477828576c915b2477bdc66adf9406799fd067f2edcc304840a280143ff90cf0a742ecc00a695b3f0bdbfc505cc527d2a71b812186b2a\”, 0, 1550322983, 1550322983]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘f890299b609247757da477828576c915b2477bdc66adf9406799fd067f2edcc3’ for key ‘authtoken_token_index’”,“Code”:0,“Trace”:”#0 \/var\/www\/html\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(128): Doctrine\\DBAL\\Driver\\AbstractMySQLDriver->convertException(‘An exception oc…’, Object(Doctrine\\DBAL\\Driver\\PDOException))\n#1 \/var\/www\/html\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Statement.php(177): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException), ‘INSERT INTO oc...', Array)\\n#2 \\\/var\\\/www\\\/html\\\/lib\\\/public\\\/AppFramework\\\/Db\\\/Mapper.php(241): Doctrine\\\\DBAL\\\\Statement->execute()\\n#3 \\\/var\\\/www\\\/html\\\/lib\\\/public\\\/AppFramework\\\/Db\\\/Mapper.php(119): OCP\\\\AppFramework\\\\Db\\\\Mapper->execute('INSERT INTOP…’, Array)\n#4 \/var\/www\/html\/lib\/private\/Authentication\/Token\/DefaultTokenProvider.php(101): OCP\\AppFramework\\Db\\Mapper->insert(Object(OC\\Authentication\\Token\\DefaultToken))\n#5 \/var\/www\/html\/lib\/private\/User\/Session.php(726): OC\\Authentication\\Token\\DefaultTokenProvider->generateToken(** sensitive parameters replaced ***)\n#6 \/var\/www\/html\/lib\/private\/User\/Session.php(965): OC\\User\\Session->createSessionToken(Object(OC\\AppFramework\\Http\\Request), ‘46D3E531-855B-4…’, ‘46D3E531-855B-4…’, NULL)\n#7 \/var\/www\/html\/apps\/oauth2\/lib\/Sabre\/OAuth2.php(120): OC\\User\\Session->tryAuthModuleLogin(Object(OC\\AppFramework\\Http\\Request))\n#8 \/var\/www\/html\/apps\/oauth2\/lib\/Sabre\/AbstractBearer.php(99): OCA\\OAuth2\\Sabre\\OAuth2->validateBearerToken(‘byRXmYzxr7xSJX7…’)\n#9 \/var\/www\/html\/lib\/composer\/sabre\/dav\/lib\/DAV\/Auth\/Plugin.php(201): OCA\\OAuth2\\Sabre\\AbstractBearer->check(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#10 \/var\/www\/html\/lib\/composer\/sabre\/dav\/lib\/DAV\/Auth\/Plugin.php(150): Sabre\\DAV\\Auth\\Plugin->check(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#11 [internal function]: Sabre\\DAV\\Auth\\Plugin->beforeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#12 \/var\/www\/html\/lib\/composer\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#13 \/var\/www\/html\/lib\/composer\/sabre\/dav\/lib\/DAV\/Server.php(466): Sabre\\Event\\EventEmitter->emit(‘beforeMethod’, Array)\n#14 \/var\/www\/html\/lib\/composer\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#15 \/var\/www\/html\/apps\/dav\/lib\/Server.php(298): Sabre\\DAV\\Server->exec()\n#16 \/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php(31): OCA\\DAV\\Server->exec()\n#17 \/var\/www\/html\/remote.php(165): require_once(’\/var\/www\/html\/a…’)\n#18 {main}",“File”:"\/var\/www\/html\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php",“Line”:66}"}

What makes me think that it is due to the server is this line:

There are code paths that trigger the generation of an auth token for the same session twice. We log this to trace the code paths. Please send all log lines belonging to this request id.

If you have any ideas,
AM.

Hey,

personally i would report such issues within the code of ownCloud directly to a bugtracker rather then to a user support forums. I think most users can’t help with such issues within the ownCloud code. Maybe you can also already find some open / related issues at https://github.com/owncloud/core/issues ?

Hi and thank you for your anwser,

I was hoping there was a quick work arround :(.
I just post on the bug tracker.

Thanks,
AM.

1 Like

Hey,

i think with such specific issues there are often no quick workarounds available / possible. :confused:

Maybe some of the developers are able to see whats wrong here and can give some hints: