Log errors related to doctrine (but nothings broken?)

Nextcloud version (eg, 12.0.2): 13.0.4
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Ngnix 1.14.0
PHP version (eg, 7.1):

The issue you are facing: Interestingly, nothing appears to not work, but I’m getting continuous Doctrine\DBAL\Exception\DriverException when I visit in a browser. I’d rather make sure that’s the case as I’m very new to this and want to ensure I don’t end up losing my data. Any input really appreciated! Speed is fantastic after a restart, but seems to bog down and it might be related?

Is this the first time you’ve seen this error? (Y/N): No, it appears every-time since I first installed.

Steps to replicate it:

  1. Have nextcloud running
  2. NA
  3. NA

The output of your Nextcloud log in Admin > Logging:

	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "fileid", "storage", "path", "parent", "name", "mimetype", "mimepart", "size", "mtime", "storage_mtime", "encrypted", "etag", "permissions", "checksum" FROM "oc_filecache" "file" WHERE ("storage" = ?) AND ((("mimepart" = ?) OR ("mimepart" = ?)) AND ("mtime" >= ?))' with params [2, 6, 8, -62104060875]: SQLSTATE[22003]: Numeric value out of range: 7 ERROR: value "-62104060875" is out of range for type integer
/var/www/cloud.mydomain.com/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128: Doctrine\DBAL\Driver\AbstractPostgreSQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
/var/www/cloud.mydomain.com/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 855: Doctrine\DBAL\DBALException driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOPgSql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'SELECT "fileid"...', Array)
/var/www/cloud.mydomain.com/nextcloud/lib/private/DB/Connection.php - line 195: Doctrine\DBAL\Connection->executeQuery('SELECT "fileid"...', Array, Array, NULL)
/var/www/cloud.mydomain.com/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 206: OC\DB\Connection->executeQuery('SELECT "fileid"...', Array, Array)
/var/www/cloud.mydomain.com/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 214: Doctrine\DBAL\Query\QueryBuilder->execute()
/var/www/cloud.mydomain.com/nextcloud/lib/private/Files/Cache/Cache.php - line 697: OC\DB\QueryBuilder\QueryBuilder->execute()
[internal function] OC\Files\Cache\Cache->searchQuery(Object(OC\Files\Search\SearchQuery))
/var/www/cloud.mydomain.com/nextcloud/lib/private/Files/Node/Folder.php - line 245: call_user_func_array(Array, Array)
/var/www/cloud.mydomain.com/nextcloud/lib/private/Files/Node/Folder.php - line 201: OC\Files\Node\Folder->searchCommon('searchQuery', Array)
/var/www/cloud.mydomain.com/nextcloud/apps/dav/lib/Files/FileSearchBackend.php - line 158: OC\Files\Node\Folder->search(Object(OC\Files\Search\SearchQuery))
/var/www/cloud.mydomain.com/nextcloud/3rdparty/icewind/searchdav/src/DAV/SearchHandler.php - line 75: OCA\DAV\Files\FileSearchBackend->search(Object(SearchDAV\XML\BasicSearch))
/var/www/cloud.mydomain.com/nextcloud/3rdparty/icewind/searchdav/src/DAV/SearchPlugin.php - line 123: SearchDAV\DAV\SearchHandler->handleSearchRequest(Array, Object(Sabre\HTTP\Response))
[internal function] SearchDAV\DAV\SearchPlugin->searchHandler(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/cloud.mydomain.com/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/cloud.mydomain.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method SEARCH', Array)
/var/www/cloud.mydomain.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/cloud.mydomain.com/nextcloud/apps/dav/lib/Server.php - line 287: Sabre\DAV\Server->exec()
/var/www/cloud.mydomain.com/nextcloud/apps/dav/appinfo/v2/remote.php - line 35: OCA\DAV\Server->exec()
/var/www/cloud.mydomain.com/nextcloud/remote.php - line 164: require_once('/var/www/cloud....')
{main}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'REDACTED',
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' => 
  array (
    0 => 'REDACTED',
    1 => 'REDACTED',
  ),
  'trusted_proxies' => 
  array (
    0 => 'REDACTED',
  ),
  'forwarded_for_headers' => 
  array (
    0 => 'HTTP_X_FORWARDED_FOR',
  ),
  'datadirectory' => '/var/www/REDACTED/nextcloud/data',
  'overwrite.cli.url' => 'https://REDACTED',
  'dbtype' => 'pgsql',
  'version' => '13.0.4.0',
  'dbname' => 'REDACTED',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'REDACTED',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'REDACTED',
  'maintenance' => false,
  'updater.secret' => 'REDACTED',
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:

Lots of these (won't paste them all as identical) 
2018/06/17 18:12:33 [error] 1866#1866: *30920 access forbidden by rule, client: IPADDRESS, server: mydomain.com, request: "GET /data/.ocdata?t=REDACTED HTTP/2.0", host: "mydomain.com"

NGINX bad rules.

check your vhost.conf for:

location ~ /. {
    access_log off;
    log_not_found off;
    deny all;  <-- **_if you do get this, think !_**
}

I’m using the config found here - the only instances of deny all are the two found there.

location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
    }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }

But this part seems more like an issue with psql and the databases

An exception occurred while executing 'SELECT "fileid", "storage", "path", "parent", "name", "mimetype", "mimepart", "size", "mtime", "storage_mtime", "encrypted", "etag", "permissions", "checksum" FROM "oc_filecache" "file" WHERE ("storage" = ?) AND ((("mimepart" = ?) OR ("mimepart" = ?)) AND ("mtime" >= ?))' with params [2, 6, 8, -62104060875]: SQLSTATE[22003]: Numeric value out of range: 7 ERROR: value "-62104060875" is out of range for type integer

could nginx really cause that?

i am more apache than nginx, but this could be possible.

sorry, no heilp

No worries, appreciate the input! :smile:

One of my server is under nginx, here a working config,

upstream php-handler {
    server                        unix:/var/run/nextcloud.sock;
}
 
server {
    listen                        80;
    listen                        [::]:80;
    server_name                   cloud.mondomaine.com;
 
    # Path to the root of your installation
    root                          /var/www/nextcloud/;
 
    # Add headers to serve security related headers
    add_header                    X-Content-Type-Options nosniff;
    add_header                    X-XSS-Protection "1; mode=block";
    add_header                    X-Robots-Tag none;
    add_header                    X-Download-Options noopen;
    add_header                    X-Permitted-Cross-Domain-Policies none;
    add_header                    Strict-Transport-Security 'max-age=31536000; includeSubDomains;';
 
    location = /robots.txt {
        allow                     all;
        log_not_found             off;
        access_log                off;
    }
 
    location = /.well-known/carddav {
      return                      301 $scheme://$host/remote.php/dav;
    }
 
    location = /.well-known/caldav {
      return                      301 $scheme://$host/remote.php/dav;
    }
 
    # set max upload size
    client_max_body_size          512M;
    fastcgi_buffers               64 4K;
 
    # Enable gzip but do not remove ETag headers
    gzip                          on;
    gzip_vary                     on;
    gzip_comp_level               4;
    gzip_min_length               256;
    gzip_proxied                  expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types                    application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
 
    location / {
        rewrite                   ^ /index.php$uri;
    }
 
    location ~ ^/.well-known/acme-challenge/* {
        allow                     all;
    }
 
    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny                      all;
    }
 
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny                      all;
    }
 
    location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+).php(?:$|/) {
        fastcgi_split_path_info   ^(.+.php)(/.*)$;
        include                   fastcgi_params;
        fastcgi_param             SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param             PATH_INFO $fastcgi_path_info;
        fastcgi_param             modHeadersAvailable true;
        fastcgi_param             front_controller_active true;
        fastcgi_pass              php-handler;
        fastcgi_intercept_errors  on;
        fastcgi_request_buffering off;
    }
 
    location ~ ^/(?:updater|ocs-provider)(?:$|/) {
        try_files                 $uri/ =404;
        index                     index.php;
    }
 
    # Adding the cache control header for js and css files
    # Make sure it is BELOW the PHP block
    location ~* .(?:css|js|woff|svg|gif)$ {
        try_files                 $uri /index.php$uri$is_args$args;
        add_header                Cache-Control "public, max-age=15778463";
        add_header                X-Content-Type-Options nosniff;
        add_header                X-XSS-Protection "1; mode=block";
        add_header                X-Robots-Tag none;
        add_header                X-Download-Options noopen;
        add_header                X-Permitted-Cross-Domain-Policies none;
        # Optional: Don't log access to assets
        access_log                off;
    }
 
    location ~* .(?:png|html|ttf|ico|jpg|jpeg)$ {
        try_files                 $uri /index.php$uri$is_args$args;
        # Optional: Don't log access to other assets
        access_log                off;
    }
}

For those who has the same problem, I found this solution:

mtime" has been added as bigint column with #8412. Here is the related issue #7637. Dont forget to run occ db:convert-filecache-bigint after update to nc14.
Cheers
rafalglog