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

SESSION_EXPIRED_CONTROL_ENABLE=True breaks SPC GeoNode #4322

Closed
frafra opened this issue Mar 29, 2019 · 10 comments
Closed

SESSION_EXPIRED_CONTROL_ENABLE=True breaks SPC GeoNode #4322

frafra opened this issue Mar 29, 2019 · 10 comments
Labels
docker Issues specific to GeoNode docker or GeoNode SPC

Comments

@frafra
Copy link
Contributor

frafra commented Mar 29, 2019

Here's what happens when setting SESSION_EXPIRED_CONTROL_ENABLE=True (default value in GeoNode, but set to False in SPCGeonode):

$,
,
,
,
-----------------------------------------------------,
STARTING DJANGO ENTRYPOINT Thu Mar 28 14:18:47 UTC 2019,
-----------------------------------------------------,
Running initialize.py...,
/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.,
  """),
JSONField implementation is: <class 'jsonfield.fields.JSONField'>,
-----------------------------------------------------,
1. Waiting for PostgreSQL,
-----------------------------------------------------,
2. Running the migrations,
Operations to perform:,
  Apply all migrations: account, actstream, admin, agon_ratings, announcements, auth, avatar, base, contenttypes, dialogos, documents, geonode_client, geonode_themes, groups, guardian, invitations, layers, maps, oauth2_provider, people, pinax_notifications, services, sessions, sites, socialaccount, taggit, tastypie, upload, user_messages,
Running migrations:,
  No migrations to apply.,
  Your models have changes that are not yet reflected in a migration, and so won't be applied.,
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.,
-----------------------------------------------------,
3. Creating/updating superuser,
superuser successfully updated,
-----------------------------------------------------,
4. Create/update an OAuth2 provider to use authorisations keys,
oauth2 provider successfully updated,
-----------------------------------------------------,
5. Loading fixtures,
Installed 301 object(s) from 1 fixture(s),
-----------------------------------------------------,
6. Running updatemaplayerip,
-----------------------------------------------------,
 Collecting static files,
-----------------------------------------------------,
8. Waiting for GeoServer,
-----------------------------------------------------,
9. Securing GeoServer,
Master password was already changed. No changes made.,
-----------------------------------------------------,
FINISHED DJANGO ENTRYPOINT --------------------------,
-----------------------------------------------------,
*** Starting uWSGI 2.0.18 (64bit) on [Thu Mar 28 14:19:09 2019] ***,
compiled with version: 6.3.0 20170516 on 26 March 2019 12:04:41,
os: Linux-4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019,
nodename: 5175656e9bb7,
machine: x86_64,
clock source: unix,
pcre jit disabled,
detected number of CPU cores: 2,
current working directory: /spcgeonode,
detected binary path: /usr/local/bin/uwsgi,
uWSGI running as root, you can use --uid/--gid/--chroot options,
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** ,
chdir() to /spcgeonode,
*** WARNING: you are running uWSGI without its master process manager ***,
your memory page size is 4096 bytes,
detected max file descriptor number: 1048576,
lock engine: pthread robust mutexes,
thunder lock: disabled (you can enable it with --thunder-lock),
uWSGI http bound on 127.0.0.1:8001 fd 3,
spawned uWSGI http 1 (pid: 16),
uwsgi socket 0 bound to TCP address :8000 fd 6,
uWSGI running as root, you can use --uid/--gid/--chroot options,
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** ,
Python version: 2.7.14 (default, May  1 2018, 23:38:34)  [GCC 6.3.0 20170516],
*** Python threads support is disabled. You can enable it with --enable-threads ***,
Python main interpreter initialized at 0x556d753d82e0,
uWSGI running as root, you can use --uid/--gid/--chroot options,
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** ,
your server socket listen backlog is limited to 100 connections,
your mercy for graceful operations on workers is 60 seconds,
mapped 364520 bytes (355 KB) for 5 cores,
*** Operational MODE: preforking ***,
/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.,
  """),
JSONField implementation is: <class 'jsonfield.fields.JSONField'>,
WSGI app 0 (mountpoint='') ready in 4 seconds on interpreter 0x556d753d82e0 pid: 1 (default app),
uWSGI running as root, you can use --uid/--gid/--chroot options,
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** ,
*** uWSGI is running in multiple interpreter mode ***,
spawned uWSGI worker 1 (pid: 1, cores: 1),
spawned uWSGI worker 2 (pid: 26, cores: 1),
spawned uWSGI worker 3 (pid: 27, cores: 1),
spawned uWSGI worker 4 (pid: 28, cores: 1),
spawned uWSGI worker 5 (pid: 29, cores: 1),
[pid: 1|app: 0|req: 1/1] 127.0.0.1 () {28 vars in 294 bytes} [Thu Mar 28 15:19:47 2019] GET / => generated 31220 bytes in 472 msecs (HTTP/1.1 200) 8 headers in 401 bytes (1 switches on core 0),
[pid: 28|app: 0|req: 1/2] 10.255.0.2 () {50 vars in 883 bytes} [Thu Mar 28 15:19:49 2019] GET / => generated 31220 bytes in 574 msecs (HTTP/1.0 200) 10 headers in 544 bytes (1 switches on core 0),
[pid: 29|app: 0|req: 1/3] 10.255.0.2 () {50 vars in 787 bytes} [Thu Mar 28 15:19:50 2019] GET /jsi18n/ => generated 11591 bytes in 26 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 1/4] 10.255.0.2 () {50 vars in 787 bytes} [Thu Mar 28 15:19:49 2019] GET /lang.js => generated 13361 bytes in 281 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 2/5] 10.255.0.2 () {48 vars in 826 bytes} [Thu Mar 28 15:19:50 2019] GET /favicon.ico => generated 20346 bytes in 97 msecs (HTTP/1.0 404) 9 headers in 468 bytes (1 switches on core 0),
[pid: 26|app: 0|req: 1/6] 10.255.0.2 () {50 vars in 829 bytes} [Thu Mar 28 15:19:50 2019] GET /api/featured/ => generated 132 bytes in 247 msecs (HTTP/1.0 200) 9 headers in 330 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 3/7] 10.255.0.2 () {56 vars in 1037 bytes} [Thu Mar 28 15:20:05 2019] POST /account/login/?next=/ => generated 22525 bytes in 91 msecs (HTTP/1.0 200) 9 headers in 461 bytes (1 switches on core 0),
[pid: 26|app: 0|req: 2/8] 10.255.0.2 () {50 vars in 808 bytes} [Thu Mar 28 15:20:06 2019] GET /jsi18n/ => generated 11591 bytes in 7 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
[pid: 29|app: 0|req: 2/9] 10.255.0.2 () {50 vars in 808 bytes} [Thu Mar 28 15:20:06 2019] GET /lang.js => generated 13361 bytes in 240 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
[pid: 28|app: 0|req: 2/10] 10.255.0.2 () {56 vars in 1045 bytes} [Thu Mar 28 15:20:14 2019] POST /account/login/ => generated 0 bytes in 44 msecs (HTTP/1.0 302) 11 headers in 548 bytes (1 switches on core 0),
[pid: 1|app: 0|req: 2/11] 10.255.0.2 () {52 vars in 944 bytes} [Thu Mar 28 15:20:14 2019] GET / => generated 32571 bytes in 306 msecs (HTTP/1.0 200) 10 headers in 536 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 4/12] 10.255.0.2 () {50 vars in 831 bytes} [Thu Mar 28 15:20:15 2019] GET /jsi18n/ => generated 11591 bytes in 8 msecs (HTTP/1.0 200) 9 headers in 373 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 5/13] 10.255.0.2 () {48 vars in 826 bytes} [Thu Mar 28 15:20:16 2019] GET /favicon.ico => generated 20346 bytes in 46 msecs (HTTP/1.0 404) 9 headers in 468 bytes (1 switches on core 0),
[pid: 29|app: 0|req: 3/14] 10.255.0.2 () {50 vars in 831 bytes} [Thu Mar 28 15:20:15 2019] GET /lang.js => generated 13361 bytes in 11009 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
[pid: 1|app: 0|req: 3/15] 10.255.0.2 () {52 vars in 910 bytes} [Thu Mar 28 15:20:26 2019] GET /layers/?limit=20 => generated 60264 bytes in 147 msecs (HTTP/1.0 200) 9 headers in 461 bytes (1 switches on core 0),
[pid: 29|app: 0|req: 4/16] 10.255.0.2 () {50 vars in 803 bytes} [Thu Mar 28 15:20:26 2019] GET /jsi18n/ => generated 11591 bytes in 5 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 6/17] 10.255.0.2 () {50 vars in 829 bytes} [Thu Mar 28 15:20:26 2019] GET /api/featured/ => generated 132 bytes in 270 msecs (HTTP/1.0 200) 9 headers in 330 bytes (1 switches on core 0),
[pid: 26|app: 0|req: 3/18] 10.255.0.2 () {50 vars in 868 bytes} [Thu Mar 28 15:20:26 2019] GET /h_keywords_api?type=layer => generated 2 bytes in 3 msecs (HTTP/1.0 200) 8 headers in 303 bytes (1 switches on core 0),
[pid: 29|app: 0|req: 5/19] 10.255.0.2 () {50 vars in 803 bytes} [Thu Mar 28 15:20:26 2019] GET /lang.js => generated 13361 bytes in 321 msecs (HTTP/1.0 200) 8 headers in 298 bytes (1 switches on core 0),
Internal Server Error: /api/categories/,
Traceback (most recent call last):,
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 221, in wrapper,
    response = callback(request, *args, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 461, in dispatch_list,
    return self.dispatch('list', request, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 493, in dispatch,
    response = method(request, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 1357, in get_list,
    for obj in to_be_serialized[self._meta.collection_name],
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__,
    self._fetch_all(),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 1121, in _fetch_all,
    self._result_cache = list(self._iterable_class(self)),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__,
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql,
    raise original_exception,
OperationalError: lost synchronization with server: got message type "e", length 1933189234,
,
Internal Server Error: /api/categories/,
Traceback (most recent call last):,
  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner,
    response = get_response(request),
  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response,
    response = self._get_response(request),
  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response,
    response = self.process_exception_by_middleware(e, request),
  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response,
    response = wrapped_callback(request, *callback_args, **callback_kwargs),
  File "/usr/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view,
    return view_func(*args, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 270, in wrapper,
    return self._handle_500(request, e),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 320, in _handle_500,
    return self.error_response(request, data, response_class=response_class),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 1292, in error_response,
    serialized = self.serialize(request, errors, desired_format),
  File "./geonode/api/api.py", line 271, in serialize,
    return super(TopicCategoryResource, self).serialize(request, data, format, options),
  File "./geonode/api/api.py", line 146, in serialize,
    return super(TypeFilteredResource, self).serialize(request, data, format, options),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 399, in serialize,
    return self._meta.serializer.serialize(data, format, options),
  File "/usr/local/lib/python2.7/site-packages/tastypie/serializers.py", line 265, in serialize,
    return method(bundle, options),
  File "./geonode/api/api.py", line 105, in to_json,
    counts = self.get_resources_counts(options),
  File "./geonode/api/api.py", line 81, in get_resources_counts,
    'base.view_resourcebase',
  File "/usr/local/lib/python2.7/site-packages/guardian/shortcuts.py", line 471, in get_objects_for_user,
    permission__codename=codename),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method,
    return getattr(self.get_queryset(), name)(*args, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 374, in get,
    num = len(clone),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 232, in __len__,
    self._fetch_all(),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 1121, in _fetch_all,
    self._result_cache = list(self._iterable_class(self)),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__,
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 887, in execute_sql,
    cursor = self.connection.cursor(),
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor,
    return self._cursor(),
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 231, in _cursor,
    return self._prepare_cursor(self.create_cursor(name)),
  File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__,
    six.reraise(dj_exc_type, dj_exc_value, traceback),
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 231, in _cursor,
    return self._prepare_cursor(self.create_cursor(name)),
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 220, in create_cursor,
    cursor = self.connection.cursor(),
InterfaceError: connection already closed,
Internal Server Error: /api/regions/,
Traceback (most recent call last):,
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 221, in wrapper,
    response = callback(request, *args, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 461, in dispatch_list,
    return self.dispatch('list', request, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 493, in dispatch,
    response = method(request, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 1352, in get_list,
    to_be_serialized = paginator.page(),
  File "/usr/local/lib/python2.7/site-packages/tastypie/paginator.py", line 194, in page,
    count = self.get_count(),
  File "/usr/local/lib/python2.7/site-packages/tastypie/paginator.py", line 126, in get_count,
    return self.objects.count(),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 364, in count,
    return self.query.get_count(using=self.db),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 499, in get_count,
    number = obj.get_aggregation(using, ['__count'])['__count'],
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 480, in get_aggregation,
    result = compiler.execute_sql(SINGLE),
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql,
    raise original_exception,
OperationalError: insufficient data in "D" message,
lost synchronization with server: got message type "�", length -65536,
,
[pid: 29|app: 0|req: 6/20] 10.255.0.2 () {50 vars in 864 bytes} [Thu Mar 28 15:20:26 2019] GET /api/regions/?type=layer => generated 88 bytes in 29 msecs (HTTP/1.0 500) 8 headers in 315 bytes (1 switches on core 0),
Internal Server Error: /api/thesaurus/keywords/,
Traceback (most recent call last):,
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 221, in wrapper,
    response = callback(request, *args, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 461, in dispatch_list,
    return self.dispatch('list', request, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 493, in dispatch,
    response = method(request, **kwargs),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 1362, in get_list,
    return self.create_response(request, to_be_serialized),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 1263, in create_response,
    serialized = self.serialize(request, data, desired_format),
  File "./geonode/api/api.py", line 195, in serialize,
    return super(ThesaurusKeywordResource, self).serialize(request, data, format, options),
  File "./geonode/api/api.py", line 146, in serialize,
    return super(TypeFilteredResource, self).serialize(request, data, format, options),
  File "/usr/local/lib/python2.7/site-packages/tastypie/resources.py", line 399, in serialize,
    return self._meta.serializer.serialize(data, format, options),
  File "/usr/local/lib/python2.7/site-packages/tastypie/serializers.py", line 265, in serialize,
    return method(bundle, options),
  File "./geonode/api/api.py", line 105, in to_json,
    counts = self.get_resources_counts(options),
  File "./geonode/api/api.py", line 81, in get_resources_counts,
    'base.view_resourcebase',
  File "/usr/local/lib/python2.7/site-packages/guardian/shortcuts.py", line 483, in get_objects_for_user,
    queryset = _get_queryset(ctype.model_class()),
  File "/usr/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 163, in model_class,
    return apps.get_model(self.app_label, self.model),
  File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 198, in get_model,
    app_label, model_name = app_label.split('.'),
ValueError: need more than 1 value to unpack,
[pid: 1|app: 0|req: 4/21] 10.255.0.2 () {50 vars in 876 bytes} [Thu Mar 28 15:20:26 2019] GET /api/layers/?limit=20&offset=0 => generated 131 bytes in 34 msecs (HTTP/1.0 200) 9 headers in 330 bytes (1 switches on core 0),
[pid: 27|app: 0|req: 7/22] 10.255.0.2 () {50 vars in 870 bytes} [Thu Mar 28 15:20:26 2019] GET /api/categories/?type=layer => generated 11917 bytes in 93 msecs (HTTP/1.0 500) 8 headers in 326 bytes (1 switches on core 0),
[pid: 1|app: 0|req: 5/23] 10.255.0.2 () {50 vars in 885 bytes} [Thu Mar 28 15:20:27 2019] GET /api/layers/?limit=20&offset=0 => generated 131 bytes in 22 msecs (HTTP/1.0 200) 9 headers in 330 bytes (1 switches on core 0),
[pid: 28|app: 0|req: 3/24] 10.255.0.2 () {50 vars in 862 bytes} [Thu Mar 28 15:20:26 2019] GET /api/owners/?type=layer => generated 558 bytes in 488 msecs (HTTP/1.0 200) 9 headers in 330 bytes (1 switches on core 0),

@afabiani said about that (in Gitter):

if you are logged out means that there's something wrong with your access tokens
a hint about session control... if you are logged out it may depend on wrong/misconfigured/missing OAuth2 "GeoServer" application on Django (see fixtures)

@t-book
Copy link
Contributor

t-book commented Apr 4, 2019

I´m experiencing something similar in dev setup from master branch:

System check identified no issues (0 silenced).
April 04, 2019 - 08:28:23
Django version 1.11.20, using settings 'geonode.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
>>> Step 2. Make sure we are not trying to overwrite a existing resource named [tiger_roads] with the wrong type
>>> Step 3. Identifying if [tiger_roads] is vector or raster and gathering extra files
>>> Step 4. Starting upload of [tiger_roads] to GeoServer...
>>> Step 5. Generating the metadata for [tiger_roads] after successful import to GeoSever
>>> Step 6. Making sure [tiger_roads] has a valid projection
>>> Step 7. Creating style for [tiger_roads]
>>> Step 10. Creating Django record for [tiger_roads]
Internal Server Error: /api/o/v4/tokeninfo/
Traceback (most recent call last):
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/core/handlers/base.py", line 131, in get_response
    response = middleware_method(request, response)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/contrib/sessions/middleware.py", line 58, in process_response
    request.session.save()
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py", line 81, in save
    return self.create()
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py", line 54, in create
    self.save(must_create=True)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py", line 87, in save
    obj.save(force_insert=must_create, force_update=not must_create, using=using)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/base.py", line 808, in save
    force_update=force_update, update_fields=update_fields)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/base.py", line 838, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/base.py", line 924, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/base.py", line 963, in _do_insert
    using=using, raw=raw)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/query.py", line 1079, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1112, in execute_sql
    cursor.execute(sql, params)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/private/tmp/x/gn/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return Database.Cursor.execute(self, query, params)
OperationalError: database is locked
"POST /api/o/v4/tokeninfo/?access_token=XNe3uxdg7ptLbTwSRD7j70LQt6PWPa HTTP/1.1" 500 173665

It´s working again with:
SESSION_EXPIRED_CONTROL_ENABLED = ast.literal_eval(os.environ.get('SESSION_EXPIRED_CONTROL_ENABLED', 'False'))

Do I miss something regarding oauth2 settings on a fresh paver start?

@afabiani
Copy link
Member

afabiani commented Apr 4, 2019

Uhm, very bad... are you using the sqllite db?

@t-book
Copy link
Contributor

t-book commented Apr 4, 2019

Uhm, very bad... are you using the sqllite db?

Yep, standard:

git clone https://github.com/GeoNode/geonode-project.git -b master
pip install -r requirements.txt --upgrade
pip install -e . --upgrade
pip install pygdal==2.3.1.4

paver setup
paver sync
paver start

@afabiani
Copy link
Member

afabiani commented Apr 4, 2019

Taking a look

@t-book
Copy link
Contributor

t-book commented Apr 4, 2019

@afabiani sorry to report this, but getting locked database with postgis in production as well. Cannot see anything wrong with oauth2. Logs mention the h2 store?!

2019-04-04 10:14:38,119 WARN [geofence.rest] - INVALIDATING CACHE
2019-04-04 10:14:38,119 WARN [geofence.cache] - Forcing cache invalidation
2019-04-04 10:14:38,189 INFO [util.FilterUtils] - Searching Rule list (unpaged) 
2019-04-04 10:14:38,221 WARN [geofence.rest] - INVALIDATING CACHE
2019-04-04 10:14:38,221 WARN [geofence.cache] - Forcing cache invalidation
2019-04-04 10:14:38,264 INFO [util.FilterUtils] - Searching Rule list (unpaged) 
2019-04-04 10:14:38,446 INFO [util.FilterUtils] - Searching Rule list  p:0#:1
2019-04-04 10:14:38,485 WARN [util.JDBCExceptionReporter] - SQL Error: 90097, SQLState: 90097
2019-04-04 10:14:38,485 ERROR [util.JDBCExceptionReporter] - The database is read only; SQL statement:
update public.gf_rule set priority=priority+? where priority>=? [90097-119]
2019-04-04 10:14:38,485 ERROR [geoserver.rest] - org.hibernate.exception.GenericJDBCException: could not execute update query
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute update query
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1315)
	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397)
	at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108)
	at org.geoserver.geofence.core.dao.impl.PrioritizableDAOImpl.shift(PrioritizableDAOImpl.java:160)
	at org.geoserver.geofence.core.dao.impl.RuleDAOImpl.shift(RuleDAOImpl.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy71.shift(Unknown Source)
	at org.geoserver.geofence.services.RuleAdminServiceImpl.shift(RuleAdminServiceImpl.java:98)
	at org.geoserver.geofence.server.rest.RulesRestController.insert(RulesRestController.java:196)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)
	at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)
	at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
	at org.geoserver.flow.controller.IpBlacklistFilter.doFilter(IpBlacklistFilter.java:89)
	at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
	at org.geoserver.monitor.MonitorFilter.doFilter(MonitorFilter.java:71)
	at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
	at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
	at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
	at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.geoserver.security.oauth2.GeoServerOAuthAuthenticationFilter.doFilter(GeoServerOAuthAuthenticationFilter.java:173)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
	at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
	at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
	at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)
	at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
	at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
	at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1463)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.hibernate.exception.GenericJDBCException: could not execute update query
	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:110)
	at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:423)
	at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:283)
	at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1288)
	at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
	at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:188)
	at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99)
	... 127 more
Caused by: org.h2.jdbc.JdbcSQLException: The database is read only; SQL statement:
update public.gf_rule set priority=priority+? where priority>=? [90097-119]
	at org.h2.message.Message.getSQLException(Message.java:106)
	at org.h2.message.Message.getSQLException(Message.java:117)
	at org.h2.message.Message.getSQLException(Message.java:76)
	at org.h2.message.Message.getSQLException(Message.java:152)
	at org.h2.engine.Database.checkWritingAllowed(Database.java:1826)
	at org.h2.engine.User.checkRight(User.java:94)
	at org.h2.command.dml.Update.update(Update.java:80)
	at org.h2.command.CommandContainer.update(CommandContainer.java:72)
	at org.h2.command.Command.executeUpdate(Command.java:208)
	at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:139)
	at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:128)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:101)
	... 133 more

@afabiani
Copy link
Member

afabiani commented Apr 4, 2019

@t-book I'm going to push a fix, it looks that django messages is not thread safe or at least it is not safely closing the db connections.

About the second issue, it is not related to oauth2. It looks to me a permission issue with the geofence db file.

About this last point, I kindly suggest to setup GeoFence rules to work against a postgres db in production and not with the default h2 one.

The same is valid for the GeoServer disk-quota (if any has been configured).

afabiani pushed a commit to geosolutions-it/geonode that referenced this issue Apr 4, 2019
@gannebamm
Copy link
Contributor

About this last point, I kindly suggest to setup GeoFence rules to work against a postgres db in production and not with the default h2 one.

which is described here: https://github.com/geoserver/geofence/wiki/GeoFence-configuration

The same is valid for the GeoServer disk-quota (if any has been configured).

no idea where to do this.

@afabiani
Copy link
Member

afabiani commented Apr 4, 2019

@gannebamm

image

@t-book
Copy link
Contributor

t-book commented Apr 4, 2019

@t-book I'm going to push a fix, it looks that django messages is not thread safe or at least it is not safely closing the db connections.

Yeah @afabiani just tested! Local dev is working again!
@frafra does this fix the issue on docker as well?

@afabiani afabiani changed the title SESSION_EXPIRED_CONTROL_ENABLE=True breaks GeoNode SESSION_EXPIRED_CONTROL_ENABLE=True breaks SPC GeoNode Apr 9, 2019
afabiani pushed a commit that referenced this issue Apr 9, 2019
[Fixes #4322] SESSION_EXPIRED_CONTROL_ENABLE=True breaks GeoNode
@afabiani
Copy link
Member

Database locked when using sqlite

@afabiani afabiani reopened this May 30, 2019
afabiani pushed a commit to geosolutions-it/geonode that referenced this issue May 30, 2019
afabiani pushed a commit to geosolutions-it/geonode that referenced this issue May 31, 2019
afabiani pushed a commit to geosolutions-it/geonode that referenced this issue May 31, 2019
afabiani pushed a commit to geosolutions-it/geonode that referenced this issue May 31, 2019
afabiani pushed a commit to geosolutions-it/geonode that referenced this issue May 31, 2019
afabiani pushed a commit to geosolutions-it/geonode that referenced this issue May 31, 2019
@t-book t-book added the docker Issues specific to GeoNode docker or GeoNode SPC label Jun 6, 2019
@afabiani afabiani closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Issues specific to GeoNode docker or GeoNode SPC
Projects
None yet
Development

No branches or pull requests

4 participants