What happens to the database when oTree 5.0 crashes?

265 views
Skip to first unread message

Joe Found

unread,
Mar 23, 2021, 6:14:15 AM3/23/21
to ot...@googlegroups.com
Hi All,
I deployed an oTree 5.0 app on Heroku with a fair number of contemporary users (~ 50 users using the chat in groups of 2) . All of a sudden the users where receiving the error

Not found: Participant, {'code': 'h71nq6az'}
and when accessing the Admin dashboard all the sessions disappeared.
It seems as if there was a crash that didn't let SqLAlchemy to save the database from memory on file.

What could be a solution to avoid losing all the data when the server crashes ?
As of now the only solution I see is to move the application to oTree 3.x

Any help is appreciated!

Thanks!
Joe

Zound3rkit3

unread,
Mar 23, 2021, 6:20:20 AM3/23/21
to oTree help & discussion
It looks like that when there is a Reset Dyno, all the data is lost ...  Am I missing some settings to use when deploying in production ?

Chris @ oTree

unread,
Mar 23, 2021, 6:31:51 AM3/23/21
to oTree help & discussion
oTree 5.0 works the same way as previous versions of oTree. The database is saved on each request, so a crash will not affect data already in there.
Maybe you reset the db? or maybe didn't set up postgres correctly.

Chris @ oTree

unread,
Mar 23, 2021, 6:33:01 AM3/23/21
to oTree help & discussion
Also, what is in your Procfile?

Chris @ oTree

unread,
Mar 23, 2021, 6:37:13 AM3/23/21
to oTree help & discussion
And can you show your Server Check Page.

Sent from my phone

> On Mar 23, 2021, at 6:33 PM, Chris @ oTree <ch...@otree.org> wrote:
>

Joe Found

unread,
Mar 23, 2021, 2:14:01 PM3/23/21
to Chris @ oTree, oTree help & discussion
Hey, thank you for this!

Procfile:
web: otree prodserver1of2
worker: otree prodserver2of2
and Server Check:
image.png
and this is the current Resource configuration:
image.png

With this configuration (the real experiment was using a more powerful dyno) I was able to create new sessions and have them running, until a dyno reboot where all the data was lost.





--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/C9A04CB5-0422-471A-948E-B052E4E2BD3C%40otree.org.

Jonas

unread,
Mar 24, 2021, 3:47:53 AM3/24/21
to oTree help & discussion
You dont seem to have a postgress database installed, which should be used for production. I am surprised that you were able to create sessions on heroku without the database (Chris can probably tell you more about this) but my guess is that if you install the heroku postgress addon this error should no longer occur. You can test this by creating a session, turning of your dynos of on again and checking if the sessions are still there.

Joe Found

unread,
Mar 24, 2021, 9:00:26 AM3/24/21
to Jonas, oTree help & discussion
You are right Jonas, The issue was solved after I installed postgres.
I was misled by the fact that the application was working normally without database installed, so I though it was storing data on file even when in production.
The Dyno restart made me realize differently ;)

I was wondering if it is possible to add a warning that checks that when in production,  the database is configured and working properly

Thank you for the help!

You received this message because you are subscribed to a topic in the Google Groups "oTree help & discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/otree/A75LfEQHS_M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/f21262ae-bbb9-4597-bd02-3a330990c2dfn%40googlegroups.com.

Chris @ oTree

unread,
Mar 24, 2021, 9:04:55 AM3/24/21
to oTree help & discussion
Your database was configured to SQLite, but it happened to be running on a platform (Heroku) that deletes the filesystem regularly, which wipes out the database.

oTree Hub does this configuration automatically and warns you if Postgres is not configured.

Reply all
Reply to author
Forward
0 new messages