Skip to content

"Internal server error" on "Login/Signup to post" #568

@amirgon

Description

@amirgon

I'm using AskBot 0.10.0 with LDAP authentication.
When signing in normally (by clicking Hi there! Please sign in), it works well.

However, when trying to post while not signed in, by clicking Login/Signup to post, I get:

Internal server error
system error log is recorded, error will be fixed as soon as possible
please report the error to the site administrators

As far as I can see, server logs do not show any error.

Activity

evgenyfadeev

evgenyfadeev commented on Mar 6, 2016

@evgenyfadeev
Member

Have you tried enabling the debug mode with "DEBUG=True" in the settings.py?

amirgon

amirgon commented on Mar 6, 2016

@amirgon
Author

With "DEBUG=True" I get the following error:

IntegrityError at /questions/61/answer/
null value in column "session_key" violates not-null constraint
DETAIL:  Failing row contains (6, null, f, 2016-03-06 04:50:42.292802-08, 10.185.4.87,  test answer, null, 61).
Request Method: POST
Request URL:    http://everasq-dev.qlc.com/questions/61/answer/
Django Version: 1.8.9
Exception Type: IntegrityError
Exception Value:    
null value in column "session_key" violates not-null constraint
DETAIL:  Failing row contains (6, null, f, 2016-03-06 04:50:42.292802-08, 10.185.4.87,  test answer, null, 61).
Exception Location: /opt/python/lib/python2.7/site-packages/django/db/backends/utils.py in execute, line 64
Python Executable:  /usr/bin/python
Python Version: 2.7.11
Python Path:    
['/opt/python/lib/python27.zip',
 '/opt/python/lib/python2.7',
 '/opt/python/lib/python2.7/plat-linux2',
 '/opt/python/lib/python2.7/lib-tk',
 '/opt/python/lib/python2.7/lib-old',
 '/opt/python/lib/python2.7/lib-dynload',
 '/opt/python/lib/python2.7/site-packages',
 '/opt/everasq/projects',
 '/opt/everasq/projects/stormoverflow',
 '/opt/everasq/projects',
 '/opt/python/lib/python2.7/site-packages/askbot/deps']
Server time:    Sun, 6 Mar 2016 04:50:42 -0800
Environment:


Request Method: POST
Request URL: http://everasq-dev.qlc.com/questions/61/answer/

Django Version: 1.8.9
Python Version: 2.7.11
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.humanize',
 'django.contrib.sitemaps',
 'django.contrib.messages',
 'compressor',
 'askbot',
 'askbot.deps.django_authopenid',
 'askbot.deps.livesettings',
 'keyedcache',
 'robots',
 'django_countries',
 'djcelery',
 'djkombu',
 'followit',
 'tinymce',
 'askbot.deps.group_messaging',
 'captcha',
 'avatar')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
 'askbot.middleware.forum_mode.ForumModeMiddleware',
 'askbot.middleware.cancel.CancelActionMiddleware',
 'askbot.middleware.view_log.ViewLogMiddleware',
 'askbot.middleware.spaceless.SpacelessMiddleware',
 'askbot.middleware.csrf.CsrfViewMiddleware')


Traceback:
File "/opt/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/python/lib/python2.7/site-packages/askbot/utils/decorators.py" in wrapper
  136.             return view_func(request, *args, **kwargs)
File "/opt/python/lib/python2.7/site-packages/askbot/utils/decorators.py" in wrapper
  231.             return view_func(request, *args, **kwargs)
File "/opt/python/lib/python2.7/site-packages/askbot/views/writers.py" in answer
  661.                     ip_addr=request.META.get('REMOTE_ADDR'),
File "/opt/python/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  127.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/python/lib/python2.7/site-packages/django/db/models/query.py" in create
  348.         obj.save(force_insert=True, using=self.db)
File "/opt/python/lib/python2.7/site-packages/django/db/models/base.py" in save
  734.                        force_update=force_update, update_fields=update_fields)
File "/opt/python/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  762.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/opt/python/lib/python2.7/site-packages/django/db/models/base.py" in _save_table
  846.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/opt/python/lib/python2.7/site-packages/django/db/models/base.py" in _do_insert
  885.                                using=using, raw=raw)
File "/opt/python/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  127.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/python/lib/python2.7/site-packages/django/db/models/query.py" in _insert
  920.         return query.get_compiler(using=using).execute_sql(return_id)
File "/opt/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  974.                 cursor.execute(sql, params)
File "/opt/python/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/opt/python/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)
File "/opt/python/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  98.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/opt/python/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: IntegrityError at /questions/61/answer/
Exception Value: null value in column "session_key" violates not-null constraint
DETAIL:  Failing row contains (6, null, f, 2016-03-06 04:50:42.292802-08, 10.185.4.87,  test answer, null, 61).

Ptosiek

Ptosiek commented on Mar 8, 2016

@Ptosiek

Facing the same issue here.
The problem is that behavior of flushing request session was changed in Django 1.8:

Changed in Django 1.8: Deletion of the session cookie is a behavior new in Django 1.8. Previously, the behavior was to regenerate the session key value that was sent back to the user in the cookie.

Hence no session_key is provided when creating an AnonymousAnswer object..
I'm totally new to askbot (started to play with it yesterday), so not really sure what a good solution would be in that case ?

added a commit that references this issue on Mar 10, 2016
e4b7ab5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @evgenyfadeev@amirgon@Ptosiek

        Issue actions

          "Internal server error" on "Login/Signup to post" · Issue #568 · ASKBOT/askbot-devel