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

Cannot create user on master (1054 Unknown column 'available' in 'where clause) #18129

Closed
PVince81 opened this issue Aug 7, 2015 · 23 comments · Fixed by #18207
Closed

Cannot create user on master (1054 Unknown column 'available' in 'where clause) #18129

PVince81 opened this issue Aug 7, 2015 · 23 comments · Fixed by #18207

Comments

@PVince81
Copy link
Contributor

PVince81 commented Aug 7, 2015

@Xenopathic please fix the regression

{"reqId":"B1Lu92E5+PPzZTM9IF86","remoteAddr":"127.0.0.1","app":"index","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\InvalidFieldNameException\",\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_storages` (`id`,`available`) SELECT ?,? FROM `oc_storages` WHERE `id` = ? AND `available` = ? HAVING COUNT(*) = 0' with params [\\\"home::user1\\\", true, \\\"home::user1\\\", true]:\\n\\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'available' in 'where clause'\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(996): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO `oc...', Array)\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(203): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db\\\/adapter.php(93): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `*P...', Array)\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(242): OC\\\\DB\\\\Adapter->insertIfNotExist('*PREFIX*storage...', Array, NULL)\\n#5 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/storage.php(61): OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*storage...', Array)\\n#6 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/cache.php(85): OC\\\\Files\\\\Cache\\\\Storage->__construct(Object(OCA\\\\Files_Trashbin\\\\Storage))\\n#7 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/home.php(74): OC\\\\Files\\\\Cache\\\\Cache->__construct(Object(OCA\\\\Files_Trashbin\\\\Storage))\\n#8 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(390): OC\\\\Files\\\\Storage\\\\Home->getCache('files', Object(OCA\\\\Files_Trashbin\\\\Storage))\\n#9 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(390): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getCache('files', Object(OCA\\\\Files_Trashbin\\\\Storage))\\n#10 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1166): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getCache('files')\\n#11 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/filesystem.php(861): OC\\\\Files\\\\View->getFileInfo('\\\/', false)\\n#12 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/files\\\/index.php(83): OC\\\\Files\\\\Filesystem::getFileInfo('\\\/', false)\\n#13 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/route\\\/route.php(154) : runtime-created function(1): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#14 [internal function]: __lambda_func(Array)\\n#15 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(274): call_user_func('\\\\x00lambda_289', Array)\\n#16 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/base.php(879): OC\\\\Route\\\\Router->match('\\\/apps\\\/files\\\/')\\n#17 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/index.php(40): OC::handleRequest()\\n#18 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":71}","level":4,"time":"2015-08-07T15:51:10+00:00","method":"GET","url":"\/owncloud\/index.php\/apps\/files\/"}

Looks like all code paths related to oc_storages needs to be tested.

@PVince81
Copy link
Contributor Author

PVince81 commented Aug 7, 2015

Caused by #13641

@PVince81 PVince81 added this to the 8.2-current milestone Aug 7, 2015
@PVince81
Copy link
Contributor Author

PVince81 commented Aug 7, 2015

Bug on my end.

@PVince81 PVince81 closed this as completed Aug 7, 2015
@RobinMcCorkell
Copy link
Member

Keyboard
Problem <-------
Chair

😆

@PVince81
Copy link
Contributor Author

PVince81 commented Aug 7, 2015

There was no chair involved, only a sofa 😉

@oparoz oparoz reopened this Aug 10, 2015
@oparoz
Copy link
Contributor

oparoz commented Aug 10, 2015

I have an acceptance test which says it's still a problem.
Might not have been caused by #13641 only if it can't be reproduce by everybody.

It was still working 3 hours ago, so there are not that many candidates.

@oparoz
Copy link
Contributor

oparoz commented Aug 10, 2015

This is the one breaking it for me @PVince81
15e16d3

  #0 /3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(116): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
  #1 /3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(996): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'INSERT INTO `oc...', Array)
  #2 /lib/private/db/connection.php(203): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)
  #3 /lib/private/db/adapter.php(93): OC\DB\Connection->executeUpdate('INSERT INTO `*P...', Array)
  #4 /lib/private/db/connection.php(242): OC\DB\Adapter->insertIfNotExist('*PREFIX*storage...', Array, NULL)
  #5 /lib/private/files/cache/storage.php(61): OC\DB\Connection->insertIfNotExist('*PREFIX*storage...', Array)
  #6 /lib/private/files/cache/cache.php(85): OC\Files\Cache\Storage->__construct(Object(OC\Files\Storage\Wrapper\Encryption))
  #7 /lib/private/files/storage/home.php(74): OC\Files\Cache\Cache->__construct(Object(OC\Files\Storage\Wrapper\Encryption))
  #8 /lib/private/files/storage/wrapper/wrapper.php(390): OC\Files\Storage\Home->getCache('files', Object(OC\Files\Storage\Wrapper\Encryption))
  #9 /lib/private/files/view.php(1166): OC\Files\Storage\Wrapper\Wrapper->getCache('files')
  #10 /lib/private/files/filesystem.php(861): OC\Files\View->getFileInfo('/', false)
  #11 /lib/private/helper.php(837): OC\Files\Filesystem::getFileInfo('/', false)
  #12 /apps/provisioning_api/lib/users.php(360): OC_Helper::getStorageInfo('/')
  #13 /apps/provisioning_api/lib/users.php(100): OCA\Provisioning_API\Users::fillStorageInfo('test', Array)
  #14 [internal function]: OCA\Provisioning_API\Users::getUser(Array)
  #15 /lib/private/api.php(145): call_user_func(Array, Array)
  #16 [internal function]: OC_API::call(Array)
  #17 /lib/private/route/router.php(280): call_user_func(Array, Array)
  #18 /ocs/v1.php(52): OC\Route\Router->match('/ocs/cloud/user...')
  #19 {main}

@PVince81
Copy link
Contributor Author

@oparoz are you sure about the bisect ? There should be no connection with the sidebar and user creation.

The problem I had is that I switched branches and the DB update didn't run as there was no difference of version in version.php.

@oparoz
Copy link
Contributor

oparoz commented Aug 11, 2015

I think it's wrong because I don't see the relationship, but if I checkout this commit and the one before, then the one before works and this one doesn't. I stayed on master.

On a fresh install, as in in a Travis container, things are broken on master, so I don't think it's a DB update issue. Since scripts are used, I can't select a specific commit to see which one broke.

@PVince81
Copy link
Contributor Author

Okay, that should be enough of a proof.
What are the reproduction steps ? Just setup OC from scratch and try and create a user ?

@oparoz
Copy link
Contributor

oparoz commented Aug 11, 2015

Yes. I'm getting different behaviours whether I'm doing it locally or on Travis though and it might be because I'm using encryption locally.

Locally, the user creation seems to work, but when I connect again, I get the trace I've posted above.

Here is the script

Create a user via the provisioning API (CreateUserCept)
Scenario:
* I am http authenticated "admin","admin"
* I have http header "Content-Type","application/x-www-form-urlencoded"
* I send post "/ocs/v1.php/cloud/users",{"userid":"test","password":"test"}
* I see response code is 200
* I see response is xml
* I see xml response includes "DOMDocument"
  [Request headers] {"Content-Type":"application/x-www-form-urlencoded"}
  [Request] POST http://localhost:8000/ocs/v1.php/cloud/users {"userid":"test","password":"test"}
  [Response] <?xml version="1.0"?>
  <ocs>
   <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
   </meta>
   <data/>
  </ocs>
* I send get "/ocs/v1.php/cloud/users/test"
* I see response code is 200
* I see response is xml
 FAIL

At the last step, I'm getting an HTML page instead of XML.
If I delete the user, it's not completely removed from the filesystem. There is still a files_encryption folder left behind.

On Travis, the error is at the user creation step

  [Request headers] {"Content-Type":"application/x-www-form-urlencoded"}
  [Request] POST http://localhost:8000//ocs/v1.php/cloud/users {"userid":"test","password":"test"}
  [Response] <?xml version="1.0"?>
  <ocs>
   <meta>
    <status>failure</status>
    <statuscode>999</statuscode>
    <message>Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:
  debug output:
  http request method: POST
  http request uri: //ocs/v1.php/cloud/users
  post parameter: userid-&gt;test
  post parameter: password-&gt;test
  </message>
   </meta>
   <data/>
  </ocs>

@PVince81
Copy link
Contributor Author

It is likely to be related to https://github.com/owncloud/core/pull/18109/files#r36731350
@nickvergessen discovered that some OCS routes are broken

@nickvergessen
Copy link
Contributor

#18202

@oparoz
Copy link
Contributor

oparoz commented Aug 11, 2015

Doesn't fix the issue at hand, at least locally. I'll wait for the change to be merged to see if Travis agrees with me.

@oparoz oparoz reopened this Aug 11, 2015
@oparoz oparoz changed the title Cannot create user on master Cannot create user on master (1054 Unknown column 'available' in 'where clause) Aug 11, 2015
@oparoz
Copy link
Contributor

oparoz commented Aug 11, 2015

If somebody is brave enough, you can use @DeepDiver1975 's PR to check the API is working: #18105

Or if you're familiar with codecption, you just need to generate an api suite and add this file: https://github.com/owncloud/gallery/blob/b84508a0b687b91b623c6f81ea99e5fe40daa846/tests/api/CreateUserCept.php

@DeepDiver1975
Copy link
Member

Yes - master is 💥

deepdiver@alien:~/Development/ownCloud/master/build/integration [ocs-api-integration-tests]$ ./run.sh 
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
8080
13135
PHP 7.0.0beta2 Development Server started at Tue Aug 11 15:02:37 2015
Listening on http://localhost:8080
Document root is /home/deepdiver/Development/ownCloud/master
Press Ctrl-C to quit.
PHP Warning:  Declaration of Behat\Behat\Console\Input\InputDefinition::getSynopsis() should be compatible with Symfony\Component\Console\Input\InputDefinition::getSynopsis($short = false) in /home/deepdiver/Development/ownCloud/master/build/integration/vendor/behat/behat/src/Behat/Behat/Console/Input/InputDefinition.php on line 157
[Tue Aug 11 15:02:39 2015] ::1:54858 [200]: /ocs/v1.php/cloud/users/test
[Tue Aug 11 15:02:39 2015] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1 table oc_storages has no column named available in /home/deepdiver/Development/ownCloud/master/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:77
Stack trace:
#0 /home/deepdiver/Development/ownCloud/master/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(77): PDO->prepare('INSERT INTO "oc...', Array)
#1 /home/deepdiver/Development/ownCloud/master/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(984): Doctrine\DBAL\Driver\PDOConnection->prepare('INSERT INTO "oc...')
#2 /home/deepdiver/Development/ownCloud/master/lib/private/db/connection.php(203): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO "oc...', Array, Array)
#3 /home/deepdiver/Development/ownCloud/master/lib/private/db/adaptersqlite.php(71): OC\DB\Connection->executeUpdate('INSERT INTO "oc...', Array)
#4 /home/deepdiver/Development/ownCloud/master/lib/private/db/connection.php(242): OC\DB\AdapterSqlite->insertIfNotExist('*PREFIX*storage...', Array,  in /home/deepdiver/Development/ownCloud/master/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 66
[Tue Aug 11 15:02:39 2015] ::1:54860 [200]: /ocs/v1.php/cloud/users
[Tue Aug 11 15:02:39 2015] ::1:54861 [200]: /ocs/v2.php/cloud/users/brand-new-user
[Tue Aug 11 15:02:39 2015] ::1:54862 [200]: /ocs/v1.php/cloud/users
[Tue Aug 11 15:02:40 2015] ::1:54863 [200]: /ocs/v2.php/cloud/users/brand-new-user
[Tue Aug 11 15:02:40 2015] ::1:54864 [200]: /ocs/v2.php/cloud/users/test

@DeepDiver1975
Copy link
Member

did we add a column to oc_storages and not increment the version? (bloody stone age schema-fu 💀 )

@PVince81
Copy link
Contributor Author

@Xenopathic added a column but he did increase version.php, didn't you?

@RobinMcCorkell
Copy link
Member

@PVince81 @DeepDiver1975 Yes, version.php was correctly modified. I remember always having to fix the merge conflicts every time there was a master change...

@oparoz
Copy link
Contributor

oparoz commented Aug 11, 2015

When I go to this commit it still works for me:
# git checkout 5590d64612c9dfe59b50108a26621b4feb570d27

Am I doing it wrong?
If not, maybe some of the right-sidebar scripts have unexpected side effects?

@DeepDiver1975
Copy link
Member

According to the version history the version was not incremented properly
8.2.0.3 as of https://github.com/owncloud/core/pull/13641/files#diff-5bbd3ccd25214f9956eea7e9f714bc08R25

but this is not show in the history of version.php
https://github.com/owncloud/core/commits/master/version.php

@DeepDiver1975
Copy link
Member

so something went wrong with one of the rebases ... solution: increment the version now

@oparoz
Copy link
Contributor

oparoz commented Aug 11, 2015

Yep, changing the version number fixes it for me.

@nickvergessen
Copy link
Contributor

so something went wrong with one of the rebases

The change was already done by:
20cf8ec#diff-5bbd3ccd25214f9956eea7e9f714bc08

So a rebase afterwards should have made it .4, I guess it didn't conflict because it was the same change?

RobinMcCorkell pushed a commit that referenced this issue Aug 11, 2015
Bump version patch number, fixes #18129
@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants