anvil.server.InvalidObjectError: Error processing object from expired session

Is anyone else seeing these errors pop up at the moment?
anvil.server.InvalidObjectError: Error processing object from expired session

We would expect this to occur if we were trying to do something with an expired object from a previous session but we have a ping-pong function designed to make a server call every 5 minutes to extend the session which I can see in the logs is working but still get the error.

So, I’d need more details, obviously, but my best guess is that your ping-pong function is working fine, until the client gets suspended (eg closing a laptop - or even being a background tab for too long in some browsers), and then it loses its session. Once it loses its session, something in your code gets a SessionExpiredError and resets the session, but some other code is still holding onto some object or capability (probably something from Data Tables), and gets the InvalidObjectError when attempting to send it to the server.

Does that make sense?

1 Like

Ok that night make sense. Typically we would have a search iterator of rows that we would be trying to keep alive. It would make sense that these rows would expire and give us this outcome.

This is relatively new though…

What can we do to narrow this down?

You can look at the traceback of the InvalidObjectError exception. It will tell you where in the client you were calling from, which will give you an idea of what objects you might have been accessing!

(Whatever those objects are, yes, it looks like they will need refreshing when you catch and recover from a session expiry.)

1 Like

Recent updates in Chrome make it more aggressive in freeing memory and putting unused tabs to sleep. Five minutes may be too long. I have an app that pings every two seconds and stays alive for days.

An easy fix would be to shorten that timer.