GLOBALEAKS / globaleaks-whistleblowing-software

GlobaLeaks is free, open-source whistleblowing software enabling anyone to easily set up and maintain a secure reporting platform.
https://www.globaleaks.org
Other
1.23k stars 269 forks source link

FOREIGN KEY constraint failed in the creation of a new context #2682

Open digimetrica opened 5 years ago

digimetrica commented 5 years ago

Hi all, After installing the application we get the following error during creation of contexts. We already tried to upgrade, restore a previous backup the application but with no clue. Below you can find the excpetion raised:

**sqlalchemy.exc.IntegrityError Wraps a DB-API IntegrityError.

Traceback (most recent call last):


  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 721, in _commit_impl
    self.engine.dialect.do_commit(self.connection)

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 443, in do_commit
    dbapi_connection.commit()

sqlite3.IntegrityError: FOREIGN KEY constraint failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 250, in inContext
    result = inContext.theWork()

  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 266, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)

  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)

  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)

  File "/usr/lib/python3/dist-packages/globaleaks/orm.py", line 119, in _wrap
    session.commit()

  File "/usr/lib/python3/dist-packages/sqlalchemy/orm/session.py", line 906, in commit
    self.transaction.commit()

  File "/usr/lib/python3/dist-packages/sqlalchemy/orm/session.py", line 465, in commit
    t[1].commit()

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1632, in commit
    self._do_commit()

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1663, in _do_commit
    self.connection._commit_impl()

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 723, in _commit_impl
    self._handle_dbapi_exception(e, None, None, None, None)

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info

  File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)

  File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 721, in _commit_impl
    self.engine.dialect.do_commit(self.connection)

  File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 443, in do_commit
    dbapi_connection.commit()

sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) FOREIGN KEY constraint failed**
evilaliv3 commented 5 years ago

Thank you @digimetrica for reporting this.

Could you provide the full globaleaks.log and access.log?

I suspect that this bug report is not related to the Context but to the Questionnaire API: https://github.com/globaleaks/GlobaLeaks/issues/2413

Is this a new setup or a multi-tenant setup ? Is it possible that you are trying to import a questionnaire that is already present on the same multi-tenant setup?

digimetrica commented 5 years ago

Hi Giovanni,

The client setup is not multitenant and the only operation we are trying to do is to add a new context

in attach you can find the globaleaks and access log files. Anyway the only thing that is logged into access.log is: "POST /admin/contexts HTTP/2" 500 99 18ms - "[REMOVED_USER_AGENT]" 1

And in globaleaks.log: 2019-09-27 15:00:34+0200 [-] [E] Unhandled exception raised: 2019-09-27 15:00:34+0200 [-] [E] sqlalchemy.exc.IntegrityError Wraps a DB-API IntegrityError.\n\nTraceback (most recent call last):\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 721, in _commit_impl\n self.engine.dialect.do_commit(self.connection)\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 443, in do_commit\n dbapi_connection.commit()\n\nsqlite3.IntegrityError: FOREIGN KEY constraint failed\n\n\nThe above exception was the direct cause of the following exception:\n\n\nTraceback (most recent call last):\n\n File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 250, in inContext\n result = inContext.theWork()\n\n File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 266, in

\n inContext.theWork = lambda: context.call(ctx, func, *args, **kw)\n\n File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext\n return self.currentContext().callWithContext(ctx, func, *args, **kw)\n\n File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext\n return func(*args,**kw)\n\n File "/usr/lib/python3/dist-packages/globaleaks/orm.py", line 119, in _wrap\n session.commit()\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/orm/session.py", line 906, in commit\n self.transaction.commit()\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/orm/session.py", line 465, in commit\n t[1].commit()\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1632, in commit\n self._do_commit()\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1663, in _do_commit\n self.connection._commit_impl()\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 723, in _commit_impl\n self._handle_dbapi_exception(e, None, None, None, None)\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception\n exc_info\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause\n reraise(type(exception), exception, tb=exc_tb, cause=cause)\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 186, in reraise\n raise value.with_traceback(tb)\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 721, in _commit_impl\n self.engine.dialect.do_commit(self.connection)\n\n File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 443, in do_commit\n dbapi_connection.commit()\n\nsqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) FOREIGN KEY constraint failed\n We already upgraded the software to the latest version. *Regards* *Salvatore Mattei* *Digimetrica SRL* Piazza Ettore Troilo, 11 65127 Pescara (Italy). EMAIL. salvatore.mattei@digimetrica.com TELEPHONE. +39 085 65850 Il giorno ven 27 set 2019 alle ore 16:47 Giovanni Pellerano < notifications@github.com> ha scritto: > Thank you @digimetrica for reporting > this. > > Could you provide the full globaleaks.log and access.log? > > I suspect that this bug report is not related to the Context but to the > Questionnaire API: #2413 > > > Is this a new setup or a multitenant setup ? Is it possible that you are > trying to importa a questionnaire that is already present on the same > multi-tenant setup? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > , > or mute the thread > > . > -- Digimetrica Srl www.digimetrica.com blog.digimetrica.com Piazza Ettore Troilo, 11 65127 - Pescara Tel: +39 085 65850 Questo messaggio di posta elettronica contiene informazioni di carattere confidenziale, rivolte esclusivamente al destinatario sopra indicato. È vietato l'uso, la diffusione, distribuzione o riproduzione da parte di ogni altra persona. Nel caso aveste ricevuto questo messaggio di posta elettronica per errore, siete pregati di segnalarlo immediatamente al mittente e distruggere quanto ricevuto (compresi i file allegati) senza farne copia. Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo di non prendere cognizione della corrispondenza tra altri soggetti, salvo più grave illecito, ed espone il responsabile alle relative conseguenze. *Before printing, think about the environment.*
evilaliv3 commented 5 years ago

Thank you @digimetrica

Are you able to reproduce the issue with a new setup?

This is a fresh new setup or already it contains some personalizations?

digimetrica commented 5 years ago

Hi, this is not a new setup, but we haven't made any personalization. we only created the first context 8 months ago and now we just want to create another one. we are not able to setup a new installation at the moment since this environment is already in "production" and the database is widely populated.

Regards.

Salvatore Mattei

evilaliv3 commented 5 years ago

I see thank you for the clarification.

At the current time we are not able to reproduce the issue.

Please let us know if you identify any detail that could help in reproduce your failure

digimetrica commented 5 years ago

Hi Giovanni, i understand that there is no way to resolve the issue on your side, so i'm asking: is there a way to dump only the leaks data from the sqlite db and import on a new installation? We are concerned about losing the data that users "uploaded" until now.

Salvatore Mattei

Digimetrica SRL Piazza Ettore Troilo, 11 65127 Pescara (Italy). EMAIL. salvatore.mattei@digimetrica.com TELEPHONE. +39 085 65850

Il giorno lun 30 set 2019 alle ore 17:30 Giovanni Pellerano < notifications@github.com> ha scritto:

I see thank you for the clarification.

At the current time we are not able to reproduce the issue.

Please let us know if you identify any detail that could help in reproduce your failure

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/globaleaks/GlobaLeaks/issues/2682?email_source=notifications&email_token=AL5DB4LTEK5R2QHLD25LZPLQMILRFA5CNFSM4I3HDJD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD76B4OY#issuecomment-536616507, or mute the thread https://github.com/notifications/unsubscribe-auth/AL5DB4PPAG3QJ2T3DNHYWMLQMILRFANCNFSM4I3HDJDQ .

--

Digimetrica Srl www.digimetrica.com

https://www.digimetrica.comblog.digimetrica.com https://blog.digimetrica.com Piazza Ettore Troilo, 11 65127 - Pescara Tel: +39 085 65850

Questo

        messaggio di 

posta elettronica contiene informazioni di carattere confidenziale, rivolte esclusivamente al destinatario sopra indicato. È vietato l'uso, la diffusione, distribuzione o riproduzione da parte di ogni altra persona. Nel caso aveste ricevuto questo messaggio di posta elettronica per errore, siete pregati di segnalarlo immediatamente al mittente e distruggere quanto ricevuto (compresi i file allegati) senza farne copia. Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo di non prendere cognizione della corrispondenza tra altri soggetti, salvo più grave illecito, ed espone il responsabile alle relative conseguenze.

Before printing, think about the environment.

evilaliv3 commented 5 years ago

Actually not it is currently not possible to export only the submissions.

I suggest you to wait some days until the bug is identified and fixed.

Which version are you currently using?

digimetrica commented 4 years ago

Gentile Salvatore Mattei, Grazie per la vostra richiesta.   La vostra richiesta è stata eseguita.

Saluti,

Salvatore Mattei Supporto Digimetrica - "supporto @ digimetrica . com"  

01/10/2019 09:13 - Salvatore Mattei ha scritto: Hi Giovanni, i understand that there is no way to resolve the issue on your side, so i'm asking: is there a way to dump only the leaks data from the sqlite db and import on a new installation? We are concerned about losing the data that users "uploaded" until now.   Salvatore Mattei

Digimetrica SRL Piazza Ettore Troilo, 11 65127 Pescara (Italy). EMAIL. [1]salvatore.mattei@digimetrica.com TELEPHONE. +39 085 65850

  Il giorno lun 30 set 2019 alle ore 17:30 Giovanni Pellerano [2]notifications@github.com ha scritto:

I see thank you for the clarification.

At the current time we are not able to reproduce the issue.

Please let us know if you identify any detail that could help in reproduce your failure

— You are receiving this because you were mentioned. Reply to this email directly, [3]view it on GitHub, or [4]mute the thread.

[1] mailto:salvatore.mattei@digimetrica.com [2] mailto:notifications@github.com [3] https://github.com/globaleaks/GlobaLeaks/issues/2682?email_source=notifications&amp;email_token=AL5DB4LTEK5R2QHLD25LZPLQMILRFA5CNFSM4I3HDJD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD76B4OY#issuecomment-536616507 [4] https://github.com/notifications/unsubscribe-auth/AL5DB4PPAG3QJ2T3DNHYWMLQMILRFANCNFSM4I3HDJDQ

--

Digimetrica Srl www.digimetrica.com

https://www.digimetrica.comblog.digimetrica.com https://blog.digimetrica.com Piazza Ettore Troilo, 11 65127 - Pescara Tel: +39 085 65850

Questo

        messaggio di 

posta elettronica contiene informazioni di carattere confidenziale, rivolte esclusivamente al destinatario sopra indicato. È vietato l'uso, la diffusione, distribuzione o riproduzione da parte di ogni altra persona. Nel caso aveste ricevuto questo messaggio di posta elettronica per errore, siete pregati di segnalarlo immediatamente al mittente e distruggere quanto ricevuto (compresi i file allegati) senza farne copia. Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo di non prendere cognizione della corrispondenza tra altri soggetti, salvo più grave illecito, ed espone il responsabile alle relative conseguenze.

Before printing, think about the environment.