I have a multithread application with threadstatic sessions that does some job with files. It's using NH to consume from services and running on an oracle db, so far so good.
Every thread has a verbose log that uses stateless session to be more lightweight. BTW when some files are processed I can see that lots of cursors are managed in oracle for log session.
For instance log:
- 324 SPC_LOG
- 310 SPC_LOG
- 121 SPC_LOG
and application itself:
- 31 SPC_PRODUCTION_LINE_TEST
- 27 SPC_PRODUCTION_LINE_TEST
- 21 SPC_PRODUCTION_LINE_TEST
This drives me to run out of Oracle cursors ORA-01000.
Does somebody has an idea about what could cause this? Are cursors related to inserts or only updates? I guess that every thread at the end of it's life closes all sessions, regular and stateless.
FYI I'm writing log this way:
In Session factory
public IStatelessSession GetUserStatelessContext(ConnectionStringSettings connection) { lock (Padlock) { string key = GetConnectionKey(connection); if (StatelessSessions == null) { StatelessSessions = new Dictionary<string, IStatelessSession>(); } if (!StatelessSessions.ContainsKey(key)) { StatelessSessions.Add(key, Factories[connection.ConnectionString].OpenStatelessSession()); } return StatelessSessions[key]; } }
And writing in log:
using (ITransaction tx = this.LogProcessErrorRepository.BeginTransaction()) { this.LogProcessErrorRepository.Add(log); if (log.Informations != null) { foreach (AdditionalInformation info in log.Informations) { info.Text = this.OracleCLOBHack(info.Text); this.AdditionalInformationRepository.Add(info); } } tx.Commit(); }