linux random reboots while running my program

Hello experts-

I am using a RH9.0 system kernel 2.4.20-31.9.  I experience this problem on my knoppix 2.4.26 machine too.

The problem occurs when I am running a program that I wrote that controls a USB HID device.  I run this program with a certain frequency as I am adding new things to it all the time.  The final product will need to speak back and forth with the USB device almost constantly (every three seconds or more to be exact).  it does not yet talk every three seconds as I have the device in debug mode currently.  So anyhow.  The reboots occur at random time intervals.  Sometimes I can only only run my program three or four times, and other times I can run it all day, about 200 times.  The programs total execution at present is about 1.35 minutes on average.  I have run my program inside Etnus TotalView memory debugging program, and found nothing, no memory leaks, no heap dump, no stack overflows.  Does anyonw have any ideas.  I would post my code but it is confidential.  Are there any errors that I may not be catching that can cause the machine to reboot instantly if not caught.  Like for instance: I believed that i was receiving a ctrl-alt-del signal in my receive buffer that the OS was picking up and using as if I had pressed that buttons on the keyboard.  I deactivated (read: commented out) the ca: trapping in my inittab file, yet i still got a reboot about 10 minutes later.   Any ideas at all would be helpful.   also if it helps any, the kernel mode driver uses a ringbuffer in user space.  I am sure this is not the problem as i can find no memory leaks in the ringbuffer but I haven't used a ring buffer since college so i could be missing something.

Thanks in advance for your help
Who is Participating?
PAQed, with points refunded (300)

E-E Admin
I'm no expert in kernel programming, or device drivers, but I'm pretty sure a usermode program can't accidentally access anything that would reboot the computer, hence the problem is almost certain to be the kernel mode driver. The latest 2.4 kernel is 2.4.27, could there be a bug which patching your kernel might fix?

Without more info, it is pretty tough to diagnose your problem. Can you at least tell us what the USB device is? Are you using pre-existing drivers, or your own?
You have debugged this code, can you tell at what point during execution the reboot occurs? If you can't post the code snippet for that point, can you tell us what it is doing, which system calls it accesses?

A possible workaround: Is the program running as root? If so, can it be made to run entirely as a normal user, since unpriveledged users should not be able to reboot the machine.
cosmowenAuthor Commented:
ok well the device is a usb Reel controller (from a slot machine)
the reboots happen at random places I cannot track it to any specific place.  I modified the skeleton driver.  All messages must be 64 BYTEs in length.

I have set the program up to run as a normal user and allowed myseld access to the /dev/usbnode1 and everything works as just a regular user until all of a sudden reboot or completely hang.

I believe you are right about the problem being in the kernel mode driver. i will bring the code over to this computer and post what i can of it, later tonight or tom.  I will also try the 2.4.27 kernel and see if that might not solve the problem.

Also i am not sure if it is relevent but the kernel mode driver does a lock_kernel() call and then it does the following unlock_kernel() but could it be getting hung somewhere in between those two calls?? and if so could that cause a reboot or a hang??

thanks for your insight
Sorry for not posting anything, I must have missed the e-mail notification of cos's last message. I'm afraid I can't offer any more usefull info - like I said I'm not a kernel hacker. Perhaps you should take this to the kernel mailing list, or one of the c.o.linux newsfroups? Good luck, and HH
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.