After some more tries the only solution I have found is not to use the
golden hammer that NH could be and do the log inserts through Oracle
ODP.Net. This way only one cursor is maintained for all inserts. Not sure
why but probably NH is not the best option when we have to optimize
resources.
Regards
On Sunday, November 18, 2012 1:16:34 PM UTC+1, guilemsola wrote:
>
> Hi All,
>
> 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? 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();
> }
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/kptnfAxqEhMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.