- Do not try to stop the timer thread in child after fork: at this moment

there's already nothing to stop.  Only mark the timer thread as stopped.
  That fixes spontaneous lockups in ruby popen call.

Reported by:	renchap @ FreeNode
This commit is contained in:
Stanislav Sedov 2010-04-27 22:14:06 +00:00
parent 805405e396
commit 561017fe76
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=253359
4 changed files with 46 additions and 1 deletions

View File

@ -170,7 +170,7 @@ RUBY?= ${LOCALBASE}/bin/${RUBY_NAME}
# Ruby 1.8
#
RUBY_RELVERSION= 1.8.7
RUBY_PORTREVISION= 0
RUBY_PORTREVISION= 1
RUBY_PORTEPOCH= 1
RUBY_PATCHLEVEL= 248

View File

@ -0,0 +1,24 @@
--- eval.c.orig 2010-04-27 01:09:22.000000000 -0700
+++ eval.c 2010-04-27 01:11:14.000000000 -0700
@@ -12343,7 +12343,7 @@
safe_mutex_lock(&time_thread.lock);
if (pthread_create(&time_thread.thread, 0, thread_timer, args) == 0) {
thread_init = 1;
- pthread_atfork(0, 0, rb_thread_stop_timer);
+ pthread_atfork(0, 0, rb_thread_stop_timer_fake);
pthread_cond_wait(&start, &time_thread.lock);
}
pthread_cleanup_pop(1);
@@ -12359,6 +12359,12 @@
pthread_cleanup_pop(1);
pthread_join(time_thread.thread, NULL);
}
+
+void
+rb_thread_stop_timer_fake()
+{
+ thread_init = 0;
+}
#elif defined(HAVE_SETITIMER)
static void
catch_timer(sig)

View File

@ -0,0 +1,10 @@
--- intern.h.orig 2010-04-27 01:11:20.000000000 -0700
+++ intern.h 2010-04-27 01:11:30.000000000 -0700
@@ -209,6 +209,7 @@
void rb_gc_mark_threads _((void));
void rb_thread_start_timer _((void));
void rb_thread_stop_timer _((void));
+void rb_thread_stop_timer_fake _((void));
void rb_thread_schedule _((void));
void rb_thread_wait_fd _((int));
int rb_thread_fd_writable _((int));

View File

@ -0,0 +1,11 @@
--- process.c.orig 2010-04-27 01:11:32.000000000 -0700
+++ process.c 2010-04-27 01:11:39.000000000 -0700
@@ -920,7 +920,7 @@
#endif
#ifdef HAVE_SETITIMER
-#define before_exec() rb_thread_stop_timer()
+#define before_exec() rb_thread_stop_timer_fake()
#define after_exec() rb_thread_start_timer()
#else
#define before_exec()