in reply to Weird CGI behaviour on different Browsers - Apache

I can think of two very annoying places where state gets kept that is out of your control:

  1. You're using mod_perl and somewhere you keep state in variables. This might be the proverbial global $counter variable or something more hidden. Usually contributing to the confusion is if you have multiple Apache processes (and mod_perl interpreter instances) where each process keeps its own state. The approach to the solution is to start Apache in the single-worker mode and to try to reproduce the failure there.
  2. Browser caching is the second nasty thing that shows you results that you don't expect. I usually use wget or curl or LWP::Simple to get at the raw data without any browser caching getting in the way.

As a general approach, I would add the appropriate indices on the database side, making the number column unique to prevent duplicate entries even if the application logic fails.

Replies are listed 'Best First'.
Re^2: Weird CGI behaviour on different Browsers - Apache
by Yaerox (Scribe) on Aug 04, 2015 at 12:31 UTC
    1. No I don't use mod_perl, good point, I should have mentioned this.

    2. Good idea, I'll keep that in mind for debuggings later on ...

    Using a primary key would help to get a good database state, I think I'll do this for future purposses too, but I really need to know for sure, the reason for this. For me solving problems is still a must do, even if I found a way to prevent things to go wrong. Thanks for the tip.

      As soon as you add the constraint to the database, the moment where the double insert happens will be shown in your server logs. This makes debugging things easier in my experience.

        Good point. I think I'll try this very soon now.