denshoproject / ddr-local

Web UI used for interacting with DDR collections and entities on a local machine.
Other
3 stars 0 forks source link

`Object of type datetime is not JSON serializable` error & background tasks. 5.2.6 local #300

Open pkikawa opened 2 years ago

pkikawa commented 2 years ago

Object of type datetime is not JSON serializable error gets thrown when user logs out of webui with open background tasks.

micah reported error initially from fernow on 5.2.6. PYK replicated on entiat on 5.2.6

Traceback 20211110.txt Screenshot 2021-11-10 151102

user is successfully logged out, but any open background tasks will be changed to pending after page refresh.

pkikawa commented 2 years ago

pending tasks can be cleared up with the usual redis-cli & flushall

gjost commented 2 years ago

@pkikawa: Normally a Django error page has almost everything needed to start debugging but errors that occur inside Celery tasks are a different matter. Celery tasks run inside a different process from the editor UI and when they crash they include only the traceback, without any of the other info.

In this case, the traceback doesn't include any references to our application code. I've gone through every place in our code where we initiate a Celery task, and there are no places where we add a datetime without turning it into a string first.

Can you ask Micah what tasks she had running in the background? I need more information before I can do anything about this bug.

gjost commented 2 years ago

pkikawa: I had no running jobs in the background. The only thing I did was edit an object then log out. I had to have something in the background tasks bar open to replicate. The edit object task had completed successfully

micah.merryman; I had logged out and realized I had forgotten to clear my background tasks. So I logged back in and clicked on background tasks, but they had switched over to pending and couldn't be cleared. So I then just hit the logout button in the tasks page and got the error. I don't remember what the hanging commits were...

micah.merryman: This was the first time I ever encountered it. I'm usually pretty good about clearing tasks before logging out. And I think it only happened in the task window, so I could just as easily logged out from the collection page and been fine. I wouldn't say it would stop me from working, just a bug I found.