Skip to contentSkip to conversation

Linux 2.6.3 doesn't suspend when mysqld is running.

DISCUSSION Pavel Machek 1 participant 2 messages Mar 21, 2004 – Apr 19, 2004 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi!

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

even if it might be a problem in mysql, it should not be possible for an unprivileged process to make the system unable to suspend. Maybe the kernel should send SIGSTOP to those processes which can't be stopped otherwise.

No, its definitely not problem in mysql.

But knowing "where it sleeps in kernel" maybe would make me understand what is going on. And I'm not going to install mysql just to find out.

Quoted 9 lines

Hi,
now I've examined the code of mysql and it seems to be a problem with signal handling. When a process is calling sigprocmask while suspending, the kernel can't stop it. If you run the code below, the system won't be able to suspend. After the kernel prints an error message that it can't stop the program, it's impossible to terminate it by any signal (even SIGKILL). The only way I've found to terminate the process is to send SIGKILL to it and then suspend the system. After resuming, the process will finally be

Quoted 1 line
Quoted 1 line

killed.

Can you try this one? (Thanks to Nigel.).

Pavel

arch/i386/kernel/signal.c renamed from linux/arch/i386/kernel/signal.c +2 -1
@@ -567,7 +567,8 @@
 
 	if (current->flags & PF_FREEZE) {
 		refrigerator(0);
-		goto no_signal;
+		if (!signal_pending(current))
+			goto no_signal;
 	}
 
 	if (!oldset)
Quoted 13 lines

#include <signal.h>
#include <errno.h>
#include <stdlib.h>

int main(int argc,char ** argv){
sigset_t set;
int sig;
sigemptyset(&set);
sigprocmask(SIG_BLOCK,&set,NULL);
while(sigwait(&set,&sig)==EINTR);
return 0;
}

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Hi!

Quoted 3 lines

this patch also didn't fix the problem. You can use the program below to test whether a patch fixes the problem yourself. If you can't suspend while this program is running, then the patch doesn't fix the problem.

Okay, this one should work. Hmm, but I'm not quite sure its the right fix.

Pavel

Quoted 11 lines

#include <signal.h>
#include <errno.h>
#include <stdlib.h>

int main(int argc,char ** argv){
sigset_t set;
int sig;
sigemptyset(&set);
while(sigwait(&set,&sig)==EINTR);
return 0;
}

kernel/signal.c +2 -0
@@ -2134,6 +2134,8 @@
 		if (timeout)
 			ret = -EINTR;
 	}
+	if (current->flags & PF_FREEZE)
+		refrigerator(1);
 
 	return ret;
 }
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]