gustavodidomenico
gustavodidomenico

Reputation: 4681

Connection issue in ASP.NET MVC + NHibernate+Oracle application after a couple of minutes

First of all, we have a MVC web application which uses NHibernate (version 3) and an Oracle 11g database.

The application is working, but when we publish in the production server a curious scenario happens:

  1. The user access the application and perform a task, for example, select a link into the Menu.
  2. The user waits a couple of minutes (2-3 minutes).
  3. The user perform another task, for example, reload the same page or select another link into the Menu.
  4. The application fails with a ORA-12571: TNS:packet writer failure exception.
  5. The user just refresh the error page, the application works.

The first thing we tried to do was to isolate the problem, so we published the application into another server with the exactly same configuration:

  1. Same binaries, of course.
  2. Same Oracle x64 client version, even the minor version.
  3. Same Windows Server 2008 version with IIS 7.5.
  4. Same IIS configuration (we compared the windows/system32/inetsrv/config files using WinMerge).
  5. Accessing the same production database.

And for our surprise we couldn't reproduce the problem.

Please, someone have a clue of what is going on?

Upvotes: 1

Views: 296

Answers (1)

gustavodidomenico
gustavodidomenico

Reputation: 4681

The problem is related to the connection pool of the server's oracle client. It seems that it is delivering invalid connections to the web application, while in the other servers it does not happens.

The solution is not very interesting, but putting the Validate Connection = True inside the connection string resolved the issue. I am aware of the performance penalty of this, but I am out of options.

PS: using this flag, each connection is validated by the connection pool service before delivering it for the client application. This is not very nice, since a database round-trip will happen for every connection request.

Upvotes: 1

Related Questions