• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
March 28, 2024, 12:33:54 pm

News:

SMF - Just Installed!


BOD (my machines crashes)

Started by henry64, October 28, 2010, 01:16:02 pm

Previous topic - Next topic

henry64

Hi Roman

I have some severe problems with my application using a nrcomm, nrgsm and a nrlogfile component, when I close my application my machines sometimes crashes - Blue screen of death with some error on wdf01000.sys. I have tried it on both a XP and Win7 machines.

It happens everytime when I close the nrcomm (nrcomm.active := false) - I guess I'm doing something wrong since I have never seen this issue with the gsmdemo!

I would like to know if you guys have seen such issue.

The structure of my application is that I create the application mainform and from the mainform I load other forms like a datamodule and the GSMForm (where the nr components are placed).
When I close my application I: first I stop and free the (my)thread that uses the nr components, then I close the nrComm then nrGsm and finally frees the GSMform. When I debug the shutdown process everything runs until I try to set nrcomm.active := false; I have tried to trace it down in the nr library but with no luck. It appeas to me that is something deep down  ??? Any suggestions how I can find the cause of the problem?














Roman Novgorodov

Hello

The GSM implementation works in user mode and it can not raise BSOD.
TnrGsm component works over serial port connection and does not make driver calls or something like that.

If you can please create simple demo that crashes PC and upload its sources here.

Also I can recommend you to try different connections for link your GSM device. Possible you will get other result by connect over native serial port (COM1) or over bluetooth. Possible problem in USB adapter or its driver.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

henry64

Thanks for your reply on this.

The strange thing is that the application didn't always crash the machines - it started some time ago. I didn't change my application except from upgrading the nrcomponents and recompile. Besides that the only thing that have been changed is the usual nummors microsoft windows updates - I suspect that some of that microsoft update might have caused this anoying problem.

Fortunately I haven't seen this problem at customer sites - they are running windows 2008 server and are probably not using WU, but I guess that's just a question of time.
I think I might have to try another GSM device too.

henry64

Hello Roman

I found this entry in the change history for v9.10
"4) Fix. RS232. Crashing after serial port closing on Delphi 2010 (and maybe all Delphi 2005 and higher). On Delphi 7 and below all was ok."
I don't know what is meant by "crash" here - but could that be what I'm expirencing just in an even worse variant = BSOD? I'm running D2009 and XE. Perhaps this is worth to have a look at? - this problem came out of nowhere and after an upgrade (or two) of nrCommLib.

henry64

I've done some more investigation on this issue.

I have an "old" gsmdemo 9.09 which you sent (the logfile says 9.08 though - I think it was a between version 9.08.5  ;D) That binary does NOT crash my machines no matter how much I open and close the port and send sms's.

9.11 and 9.12 (haven't tried 9.10) crashes my machines sometimes at the first "close" sometimes at the second "close".

I'm talking about the gsmdemo - not my application.

I have one machine running windows 7 and one XP - same driver version.

I think there have been some changes at the library that makes the driver go crasy. I have tried connection using remote desktop (sharing the GSM device) - in that case the remote machine crashes (also XP) - but the machine which is running the application does not crash. So nothing "bad" seems to happen in the application - although, as mentioned only versions after 9.09 causes this.  ::) :o


Roman Novgorodov

Hello

Thank you for your information. Can you upload here LOG file from GSMDemo that crashes into BSOD. Possible there is some info in log file.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

henry64

Hi Roman

Here's the logfile - it crashed at the second "close". I don't see anything in the logfil though.

I have tried downgrading all the way down to 9.08 - 9.08 works and doesn't crash - I don't have the source for that version so I'm unable to trace into the code.

henry64

procedure TnrCustomComm.ForceHalt(aClear:boolean);
begin
  if Handle <> INVALID_HANDLE_VALUE {Active and not(csDesigning in ComponentState) }then begin


------->>>>   SetCommMask(Handle,0);
// this seems to cause the crash it's a kernel32 I see it's not your code, but do you have any suggestions for a solution?




    ThreadStop;

    if aClear and (NotYetSend > 0) then ClearDeviceBuffers;

//    if aClear then begin

      //CommThread.Terminate;
      //if NotYetSend > 0 then ClearDeviceBuffers;
      //nrCancelIO(Handle);
//      OutputDebugString('SetCommMask( 000');

//      OutputDebugString('SetCommMask( 111');
//      ThreadStop;
//      if NotYetSend > 0 then ClearDeviceBuffers;
//    end else ThreadStop;

//    OutputDebugString('Close Handle 0 ');
    //if not
    //CloseHandle(Handle);
//      then OutputDebugString(PChar('Close Handle ERR ' + SysErrorMessage(GetLastError)));
//    OutputDebugString('Close Handle 1 ');
    FreeBuffer;
    inherited Close;
    DoNotify(csClosed);
//    OutputDebugString('... TnrCustomComm.ForceHalt() done.');
  end
end;

henry64

I would like to show you this discussion - I don't know if it's relevat to this problem - i'm more of a Database guy  8)

http://www.cygnal.org/ubb/Forum9/HTML/002008.html

Just try to google setcommmask crash  ;D

Roman Novgorodov

Hello

Thank you for your information.

Unfortunately we can not reproduce problem.
We tested with native (built-in COM1)  serial port, with virtual serial ports of various USB2RS232 adapters, with serial ports on external PCI card.
We tried on Windows XP and on Win7 with latest updates on 24 Oct 2010.
Port closes and opens repeatedly without errors.

It seems like this is problem in system drivers for your device. :-(
Possible you are using something like GSM USB Stick. You can try to update its drivers or its internal firmware.
Better if you will try other hardware instead your WAVECOM, maybe you can test Siemens MC75 or others.

Also you can play with TnrComm.UseMainThread property.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

henry64

Hi Roman

I have mailed you nrgsm and nrcomm where I have changed some things that appears "wrong" to me - e.g. the way that the two threads are created and terminated. I think that you only use setcommmask (handle, 0) to try to signal the treads waitforsingleobject. I have made an alternative to that - maybe you would like to use that instead.

At least it solves my problem and you don't need to use lowlevel rutines.?? Have a look at it  ;D

Roman Novgorodov

November 04, 2010, 09:59:53 am #11 Last Edit: November 04, 2010, 10:36:08 am by Roman Novgorodov
Hello

Yes. I've go it. We will investigate these sources.
But please note that TnrComm component supports the hot plug off (removing) the opened serial port. And existing code handles this situation. We can not to lost this significant functionality.
About notes regarding SetCommMask(Handle, 0). It should return error and set GetLastError code or pulse blocked WaitComm() function. It can not raise BSOD. It is problem in the kernel drivers of Windows.
We will check more.

By the way, you show a good skill in your code - you are more than a simple database guy :-).

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

henry64

Quote from: Roman Novgorodov on November 04, 2010, 09:59:53 am
Hello

Yes. I've go it. We will investigate these sources.
But please note that TnrComm component supports the hot plug off (removing) the opened serial port. And existing code handles this situation. We can not to lost this significant functionality.
>> No of course not, I have only focused on my problem so far.


About notes regarding SetCommMask(Handle, 0). It should return error and set GetLastError code or pulse blocked WaitComm() function. It can not raise BSOD. It is problem in the kernel drivers of Windows.
>> Yes you are probably right, it's a device driver that causes this as it should handle errors rather than BSOD  :o

Keep up the good work  8)