EldoS | Feel safer!

Software components for data protection, secure storage and transfer

System.NullReferenceException while shutdown

Posted: 04/21/2010 08:40:48
by Ralf Grenzing (Standard support level)
Joined: 05/29/2007
Posts: 4

Hi there,

we using MsgConnect in the latest version to send Messages from our IIS hosted application server to Win32 Delphi clients. Sometimes when the process is ended (e.g. the IIS did a recycling) we got an exception. The message in the eventlog is always the same:

Exception: System.NullReferenceException

Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

StackTrace: bei MsgConnect.MCSocketThread.KickThread(Boolean MessageFlag)
bei MsgConnect.MCThreadPool.Clear()
bei MsgConnect.MCThreadPool.Finalize()

because we can "nearly" reproduce the error we can use a debug version if there is any.

best regards

Ralf Grenzing - OPUS//G
Posted: 04/21/2010 15:50:15
by Eugene Mayevski (Team)

The easiest would be to disable UDP notification using NoUDPNotify property, if it doesn't affect performance. IF it does (and so using this property is not possible), then we'd need to find some way to reproduce the bug.

As a registered customer you have access to the source code of MsgConnect so you can build the debug assembly and actually debug it by including MsgConnect Visual Studio project to your solution and referencing it instead of the precompiled assembly.

Sincerely yours
Eugene Mayevski
Posted: 04/22/2010 02:39:01
by Ralf Grenzing (Standard support level)
Joined: 05/29/2007
Posts: 4


I searched via Reflection the MsgConnectNET20.dll assembly but did not find aNoUDPNotify property I can set. We are using the above Code to initialize MsgConnect (CLR is set). AFAIKS we do not use UDP there at all so I think it is safe to disable it?

thanks for the fast answer

Ralf Grenzing - OPUS//G

The Code:

procedure TMxIPC.InitMCComponents;
Messenger := TMCMessenger.Create(nil);
prv_Socket:= TMCSocketTransport.Create(nil);
WorkTimer := TTimer.Create(nil);
Queue := TMCQueue.Create(nil);
Messenger := TMCMessenger.Create;
prv_Socket:= TMCSocketTransport.Create;
Queue := TMCQueue.Create;

Messenger.Name := 'Messenger';
Messenger.MaxTimeout := 7200000;

prv_Socket.Name := 'Socket';
prv_Socket.Messenger := Messenger;
prv_Socket.Active := False;
prv_Socket.MaxMsgSize := 65535;
prv_Socket.MaxTimeout := 900000;
{$IFNDEF CLR}prv_Socket.UseStorage := False;{$ENDIF}
prv_Socket.ConnectionTimeout := 3000;
prv_Socket.AttemptsInterval := 15000;
prv_Socket.AttemptsToConnect := 3;
prv_Socket.ClientThreadLimit := 0;
prv_Socket.FailOnInactive := True;
prv_Socket.InactivityTime := 0;
prv_Socket.IncomingMemoryThreshold := 0;
prv_Socket.MessengerAddress := '';
prv_Socket.OutgoingMemoryThreshold := 0;
prv_Socket.ThreadPoolSize := 0;
prv_Socket.TransportMode := stmP2P;
prv_Socket.UseTempFilesForIncoming := False;
prv_Socket.UseTempFilesForOutgoing := False;
prv_Socket.SocksUserCode := 'Administrator';
prv_Socket.SocksVersion := mcSocks4;
prv_Socket.SocksAuthentication := saNoAuthentication;
prv_Socket.WebTunnelPort := 3128;
prv_Socket.IncomingSpeedLimit := 0;
prv_Socket.OutgoingSpeedLimit := 0;
prv_Socket.ReuseServerPort := False;
prv_Socket.BandwidthPolicy := bpStrict;

include(prv_Socket.OnDisconnected, OnDisconnected);

WorkTimer.Name := 'WorkTimer';
WorkTimer.Enabled := False;
WorkTimer.Interval := 250;
WorkTimer.OnTimer := WorkTimerTimer;

Queue.Name := 'Queue';
Queue.Messenger := Messenger;
Queue.Handlers.Add.MsgCodeHigh := 2147483647;
Queue.Handlers.Add.MsgCodeLow := 0;
Queue.OnUnhandledMessage := ASyncQueueUnhandledMessage;
Include(Queue.OnUnhandledMessage, ASyncQueueUnhandledMessage);
Queue.QueueName := 'OPUSG_MesQ';
Posted: 04/22/2010 10:09:27
by Eugene Mayevski (Team)

Are you sure that you checked the right assembly? NoUDPNotify is a property of MCInetTransport class (whose descendant MCSocketTransport is). And it IS there.

As for "not using UDP" -- UDP notifications are used (by default) in MCInetTransport to notify the worker thread about necessity to shut down the operations OR that the pending outgoing message is present. Disabling them will cause the components use another notification mechanism which is several milliseconds slower. This is a tiny delay for one message, but can be significant in some scenarios.

Sincerely yours
Eugene Mayevski
Posted: 04/23/2010 15:09:28
by Ralf Grenzing (Standard support level)
Joined: 05/29/2007
Posts: 4

We did not have that that many messages therefore I think it is
save to change the mode. I added

prv_Socket.NoUDPNotify := True;

I guess that was all you suggested?

I guess I did not find the property because I searched a rather old dll.

best regards
Ralf Grenzing - OPUS//G
Posted: 04/24/2010 02:26:07
by Eugene Mayevski (Team)

Yes, that's it. Let me know if the problem persists.

Sincerely yours
Eugene Mayevski
Posted: 06/22/2010 07:20:54
by Ralf Grenzing (Standard support level)
Joined: 05/29/2007
Posts: 4

Hi Eugene,

I checked the server today and it seems that that error is now gone. Thanks for your help

best regards

Ralf Grenzing



Topic viewed 9186 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!