#1
by
alan_schamp
I've been getting the the following intermittent error in the Heroku server logs:
2026-04-17T17:29:33.084805+00:00 app[web.1]: Error during __repr__ of Player: DetachedInstanceError('Instance <Player at 0x70f6ad0ca570> is not bound to a Session; attribute refresh operation cannot proceed')
The stack trace is included as an attachment.
I saw that there was a post a few years ago describing the same error but the resolution did not seem to apply. I've also attached the Python function referenced in the stack trace. The function is called from the vars_for_template and js_vars functions (also attached).
Any ideas?
#2
by
alan_schamp
For performance reasons I had been storing players list as a global variable and reusing that list throughout the code to avoid getting "group.get_players()" repeatedly. Chris suggested that I not store "players" list globally and that I refresh the list periodically when needed (but not with every access). Since I made and deployed the changes suggested by Chris, the problem seems to be resolved,