C Sleep function hangs @ __kernel_vsyscall ()


 
Thread Tools Search this Thread
Top Forums Programming C Sleep function hangs @ __kernel_vsyscall ()
# 1  
Old 06-16-2011
C Sleep function hangs @ __kernel_vsyscall ()

This is the gdb backtrace.

Code:
^C
Program received signal SIGINT, Interrupt.
0xffffe424 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb7e56a70 in __nanosleep_nocancel () from /lib/libc.so.6
#2  0xb7e568bb in __sleep (seconds=0) at sleep.c:138
#3  0x080496d5 in apSleep (msec=20) at xyz.c:10

Any clues?
Smilie

Last edited by pludi; 06-16-2011 at 04:10 AM..
# 2  
Old 06-16-2011
Quote:
Originally Posted by dragonpoint
This is the gdb backtrace.

^C
Program received signal SIGINT, Interrupt.
0xffffe424 in __kernel_vsyscall ()
(gdb) bt
#0 0xffffe424 in __kernel_vsyscall ()
#1 0xb7e56a70 in __nanosleep_nocancel () from /lib/libc.so.6
#2 0xb7e568bb in __sleep (seconds=0) at sleep.c:138
#3 0x080496d5 in apSleep (msec=20) at xyz.c:10

Any clues?
Smilie
Hello dragon,

Do you have access to the source ? If yes, can you post if over here (only the relevant part) ..

Thanks,
Gaurav.
# 3  
Old 06-16-2011
Are you blocking SIGALRM? sleep usually works by setting a timer, then sending a SIGALRM signal to the calling process.
# 4  
Old 06-16-2011
Quote:
Originally Posted by jim mcnamara
Are you blocking SIGALRM? sleep usually works by setting a timer, then sending a SIGALRM signal to the calling process.
That's normally no longer true.

And in this case, its pretty likely that sleep() has been implemented with a version of nanoslee().

It would be nice to see what the actual source code is, though.

If you look, it appears as if the file "sleep.c" calls __nanosleep_nocancel() directly. That could be something in the way libc actually links in nanosleep(), but maybe not? And if what's supposed to be an internal call is being used incorrectly, maybe the sleep time is a very large 64-bit integer - and the call does have "nocancel" appended to it....
# 5  
Old 06-17-2011
I had the code running on the system, before enabling hyperthreading. Does HT/ SMP have any side effects? I am not using any pthread libs either.

PS:
I apologize, i couldn't get access to the code since its on my work m/c and am at home. I will try to get some snippets posted tomoro.
# 6  
Old 06-17-2011
Hi,

From the man page -
SIGINT is sent when the user on the process' controlling terminal presses the interrupt the running process key - typically Control-C, but on some systems, the "delete" character or "break" key.


So how come is that case even possible on its own ? Please correct me if I am wrong.

Thanks,
Gaurav.
# 7  
Old 06-17-2011
Quote:
Originally Posted by gaurav1086
So how come is that case even possible on its own ? Please correct me if I am wrong.
I do believe he actually did hit control-C, to kill the program after it hanged. But sigint can also be sent by the kill utility and/or system call if you're curious.

Or if you're asking how ctrl-c sends an interrupt, the kernel does that for you, it's an ordinary property of terminal devices.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

While loop hangs in function running in background

Hello Everyone, I am writing a shell script to fetch log files from remote servers within a time range. It copies log files to local server, grep for date and then compares the time stamp of each log entry with the once specified. Below is the code. # Get log and Parsing function ... (1 Reply)
Discussion started by: kanagalamurali
1 Replies

2. Programming

Doubt with signals and sleep function

Hi , I have a doubt with signals and sleep function. In a program i have this while(1) { //do some work sleep(1); }And in a thread i have something like this union sigval data; char message; char msg; data.sival_int=0; while(1) { ... (4 Replies)
Discussion started by: bacesado
4 Replies

3. Programming

Sleep function not detected

Hello Im using geany to write my c codes. Below is my code to make the internal LED of beaglebone flashing. But i cant seem to use the sleep or delay to make the program wait for a couple of miliseconds. I've included all include files that i can find but none of it solve the problem. Any help is... (1 Reply)
Discussion started by: HellRyder
1 Replies

4. Red Hat

core dump analysis : __kernel_vsyscall ()

We have just enabled core dump on our RHEL5.7 OS. the java process is terminating very often so we enable core dump to analysis the issue and find below in core dump file. Core was generated by `/usr/java/jdk1.6.0_06//bin/java -server -Xms1536m -Xmx1536m -Xmn576m -XX:+Aggre'. Program... (0 Replies)
Discussion started by: pawankkamboj
0 Replies

5. Shell Programming and Scripting

How the Sleep function will work?

Hi All, I am new to Unix , there i am facing one problem with sleep command. that is .. in while loop i have defined sleep function .. my condition is like this while #i knew this is infinite loop do sleep 200 echo "hello " done. this condition will never become .. true... (3 Replies)
Discussion started by: mandlysreedhar
3 Replies

6. Programming

__kernel_vsyscall ()

I'm trying to compile a program called varkon, but after I chose an option from the main screen it gives me a segfault. The code is to long for me to go through it all, so I tried using gdb. This was the output: Reading symbols from /home/oliverj/Downloads/varkon/bin/xvarkon...(no debugging... (5 Replies)
Discussion started by: weirdo77
5 Replies

7. Shell Programming and Scripting

Help with sleep function

Hey everyone, just entering the linux world, I need some help with a shell script i'm trying to write, the purpose is to check every 10 minutes what was the last time a certain file was modified, and if there is a connection to the server at this moment send an email with the date of the... (2 Replies)
Discussion started by: moshe88
2 Replies

8. Shell Programming and Scripting

Wrapping 'sleep' with my 'resleep' function (Resettable sleep)

This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way: How many times have you used the... (5 Replies)
Discussion started by: deckard
5 Replies

9. Shell Programming and Scripting

Sleep under one second

If I want a script to sleep for less than a second, would I use a decimal? In other words, if I wanted my script to sleep for 1/4 of a second, would I say, SLEEP .25 ?? (5 Replies)
Discussion started by: Scoogie
5 Replies
Login or Register to Ask a Question