Skip to content

Commit de82439

Browse files
committed
Do not use pthread_setaffinity_np on s390x
Looks like it randomly causes a segfault https://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20231025T093302Z.fail.html.gz ``` [11186/26148] TestNetHTTP_v1_2#test_set_form/home/chkbuild/build/20231025T093302Z/ruby/tool/lib/webrick/httprequest.rb:197: [BUG] Segmentation fault at 0x000003ff1ffff000 ruby 3.3.0dev (2023-10-25T07:50:00Z master 526292d) [s390x-linux] ```
1 parent 54a5623 commit de82439

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/socket/raddrinfo.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ rb_getaddrinfo(const char *hostp, const char *portp, const struct addrinfo *hint
482482
}
483483

484484
pthread_detach(th);
485-
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU)
485+
#if defined(__s390__) || defined(__s390x__) || defined(__zarch__) || defined(__SYSC_ZARCH__)
486+
# define S390X
487+
#endif
488+
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU) && !defined(S390X)
486489
cpu_set_t tmp_cpu_set;
487490
CPU_ZERO(&tmp_cpu_set);
488491
CPU_SET(sched_getcpu(), &tmp_cpu_set);
@@ -701,7 +704,7 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen,
701704
}
702705

703706
pthread_detach(th);
704-
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU)
707+
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU) && !defined(S390X)
705708
cpu_set_t tmp_cpu_set;
706709
CPU_ZERO(&tmp_cpu_set);
707710
CPU_SET(sched_getcpu(), &tmp_cpu_set);

0 commit comments

Comments
 (0)