Commands are executed twice in my app

Hi all,

I'm managing an shiny app that every once in a while shows some very strange behaviour. The app itself is many thousands of lines of code, so it's hard to provide a minimal example -- I'm hoping that by explaining the issue, maybe someone else has experienced something similar?

Basically, the app is a read/write interface to a database table. There's a sign on procedure, where the user provides an email address and is authenticated against a table of allowed users, and we check if the user has the correct database permissions. If authentication succeeds, the main part of the app opens with a view of the database, as well as a way to add entries to the database (with lots of input validation, etc.). We log the user's actions by printing a lot of statements about user actions to the application log file, making it possible to track how users are using the app.

Every now and then, a user tries to use the app to add entries to the database, and finds that her entries are written two times to the db. Checking what happens in the log files, we see something like this:

...so a lot of the commands in the app, including the EXECUTE statement that sends data to the db, are executed two times after one another. It's all happening within the same process (the number '7954' is the PID). You get the feeling that two instances of the app are running in parallel -- all observers, values etc. in the app are created twice, every click on an actionButton results in the same code being executed two times, etc. The trouble is, of course, that the bug creates all kinds of trouble for our data validation.

The bug is fairly rare -- we have at least a handful of users using the app on a daily basis, and we see the bug maybe once or twice per month. The app is configured in the utilization scheduler (on Shiny Server Pro), so it should not be related to multiple users sharing the same session. Does this behavior ring a bell for anybody?