Forum OpenACS Q&A: Help! AOLserver hangs on "double-click."

It looks like I have a serious problem here.

I have AOLserver 3.2, OpenACS 3.2.4 and PostgresQL 7.0.3 installed and running. Everything works fine, except when I replicate a "double-click" event. I'll describe the situation: I decide to insert a new item (any item that has a unique column in the database - a user, a bboard topic, a general-comment, almost anything). I fill out the forms, submit, confirm - everything goes well. Then I click the "back" button in my browser. The "confirm" page, or previous form page in the absence of a confirm page, is displayed, but not reloaded, because my browser loaded it from cache.

IMPORTANT: This confirm or form page has already generated a "unique" primary key from the sequence, so I'm trying to reuse a primary key. In some cases, such as in general-comments, I back up twice, to get to the page that actually generates the primary key. This page is also loaded from cache.

When I hit "submit," AOLserver hangs. PostgreSQL stays happy and alive. In my postgresql /var/log/ file I get an "ERROR: Cannot insert a duplicate key into unique index users_pkey" (or whichever unique btree it couldn't insert into). In my server.log (for AOLserver) is a message like this:

[17/Dec/2000:17:52:57][18836.6149][-conn1-] Error:

There is no newline at the end of this message. AOLserver seems to have hung while trying to write the message (I'm not guessing that the actual writing of the message was what hung AOLserver). It obviously has sent the query to postgres, but I don't know if it's having problems receiving an error message from postgres, throwing an exception, catching that exception, or what.

Summary: anytime I try to insert a new row with the same primary key as an existing row, PostgreSQL simply rejects it, and AOLserver hangs.

PLEASE, if anyone has any suggestions, help! I'm already two days past deadline on this project, and I'm at my wit's end.

Collapse
Posted by Ravi Gadad on
I figured it out.  I'm so sorry for wasting your time.. I feel rather
idiotic now.  I had two postgres drivers in my bin directory -
nspostgres.so, and postgres.so.  I'd compiled the
nspostgres.so driver, which is the one from the AOLserver
website, before I realized I needed the OpenACS one.  When I
compiled the OpenACS one, of course it didn't replace the
original one, so I didn't think about changing my config files to
reference the new one.

Is there a reason for the OpenACS postgres driver being named
postgres.so, veering from the ns(x).so convention?  I'm just
wondering if this is a problem that can be avoided in the future,
so no one else has this same problem.

Collapse
Posted by Don Baccus on
It's not clear to me how our driver diverted from the one distributed with AOLserver, since they asked for and got a copy of it and were going to incorporate it.  And they've asked Lamar Owen and I to maintain their distributed copy as well, which hasn't quite happened yet (I've been busy, Kriston has to get me cvs privs at sourceforge, etc).

Anyway ... for ACS 4.0, the driver's likely to really diverge as it will be full of a bunch of stuff to map aD's Oracle's ns_ora routines that handle bind variables into routines that will build them into legal Postgres queries.  The AOLserver version of the driver won't need these extra routines.

As far as the name change, originally postgres.so was offered as a demonstration of how to write a database driver for AOLserver.  The switch from postgres.so to nspostgres.so came about, I believe, with AOLserver 3.0.  We should probably track that change, I suppose...