posix_mq RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/5] notify: set lower bound for notify stack size
  2012-07-12 19:45  4% [PATCH 0/5] some FreeBSD9 fixes pushed to master Eric Wong
@ 2012-07-12 19:45  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2012-07-12 19:45 UTC (permalink / raw)
  To: ruby.posix.mq

Some OSes have ridiculously low boundaries and we don't
want mysterious failures on them
---
 ext/posix_mq/posix_mq.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/ext/posix_mq/posix_mq.c b/ext/posix_mq/posix_mq.c
index df667e3..66f3f99 100644
--- a/ext/posix_mq/posix_mq.c
+++ b/ext/posix_mq/posix_mq.c
@@ -850,6 +850,19 @@ static void my_mq_notify(mqd_t des, struct sigevent *not)
 	}
 }
 
+static void lower_stack_size(pthread_attr_t *attr)
+{
+/* some OSes have ridiculously small stack sizes */
+#ifdef PTHREAD_STACK_MIN
+	size_t stack_size = PTHREAD_STACK_MIN;
+	size_t min_size = 4096;
+
+	if (stack_size < min_size)
+		stack_size = min_size;
+	pthread_attr_setstacksize(attr, stack_size);
+#endif
+}
+
 /* :nodoc: */
 static VALUE setnotify_exec(VALUE self, VALUE io, VALUE thr)
 {
@@ -864,10 +877,7 @@ static VALUE setnotify_exec(VALUE self, VALUE io, VALUE thr)
 	errno = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	if (errno) rb_sys_fail("pthread_attr_setdetachstate");
 
-#ifdef PTHREAD_STACK_MIN
-	(void)pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
-#endif
-
+	lower_stack_size(&attr);
 	not.sigev_notify = SIGEV_THREAD;
 	not.sigev_notify_function = thread_notify_fd;
 	not.sigev_notify_attributes = &attr;
-- 
1.7.11.rc0.55.gb2478aa



^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] some FreeBSD9 fixes pushed to master
@ 2012-07-12 19:45  4% Eric Wong
  2012-07-12 19:45  7% ` [PATCH 1/5] notify: set lower bound for notify stack size Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2012-07-12 19:45 UTC (permalink / raw)
  To: ruby.posix.mq

The following are now in "master" of git://bogomips.org/ruby_posix_mq

  [1/5] notify: set lower bound for notify stack size
  [2/5] ext: fix type inconsistencies for int vs mqd_t retvals
  [3/5] test: disable IO.select test if #to_io is missing
  [4/5] extconf: fix __mq_oshandle() detection on FreeBSD
  [5/5] test: relax test timings for timed* tests

I still get the following failures under FreeBSD 9.  I suspect
some functionality fails across forks, even though mq_send/mq_receive
continue to work across forks:

ruby -I lib:tmp/ext/ruby-1.8.7/ext/posix_mq test/test_posix_mq.rb 
POSIX_MQ#notify not supported on this platform: i386-freebsd9
Loaded suite test/test_posix_mq
Started
...................#<Errno::EBADF: Bad file descriptor - mq_notify>
F..........test/test_posix_mq.rb:297:in `nonblock=': Bad file descriptor - mq_setattr (Errno::EBADF)
	from test/test_posix_mq.rb:297:in `test_setattr_fork'
	from test/test_posix_mq.rb:297:in `fork'
	from test/test_posix_mq.rb:297:in `test_setattr_fork'
	from /usr/local/lib/ruby/1.8/test/unit/testcase.rb:78:in `__send__'
	from /usr/local/lib/ruby/1.8/test/unit/testcase.rb:78:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
	from /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
	from /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
	from /usr/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
	from /usr/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
	from /usr/local/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
	from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
	from /usr/local/lib/ruby/1.8/test/unit.rb:279
	from test/test_posix_mq.rb:421
F.........
Finished in 2.431081 seconds.

  1) Failure:
test_notify_none(Test_POSIX_MQ) [test/test_posix_mq.rb:276]:
#<Process::Status: pid=39972,exited(1)>.
<false> is not true.

  2) Failure:
test_setattr_fork(Test_POSIX_MQ) [test/test_posix_mq.rb:298]:
<false> is not true.

40 tests, 238 assertions, 2 failures, 0 errors
gmake: *** [test/test_posix_mq.rb] Error 1

-- 
EW


^ permalink raw reply	[relevance 4%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2012-07-12 19:45  4% [PATCH 0/5] some FreeBSD9 fixes pushed to master Eric Wong
2012-07-12 19:45  7% ` [PATCH 1/5] notify: set lower bound for notify stack size Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/ruby_posix_mq.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).