Skip to content

Commit

Permalink
Do not use pthread_setaffinity_np on s390x
Browse files Browse the repository at this point in the history
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]
```
  • Loading branch information
mame committed Oct 25, 2023
1 parent 54a5623 commit de82439
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ext/socket/raddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,10 @@ rb_getaddrinfo(const char *hostp, const char *portp, const struct addrinfo *hint
}

pthread_detach(th);
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU)
#if defined(__s390__) || defined(__s390x__) || defined(__zarch__) || defined(__SYSC_ZARCH__)
# define S390X
#endif
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU) && !defined(S390X)
cpu_set_t tmp_cpu_set;
CPU_ZERO(&tmp_cpu_set);
CPU_SET(sched_getcpu(), &tmp_cpu_set);
Expand Down Expand Up @@ -701,7 +704,7 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen,
}

pthread_detach(th);
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU)
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU) && !defined(S390X)
cpu_set_t tmp_cpu_set;
CPU_ZERO(&tmp_cpu_set);
CPU_SET(sched_getcpu(), &tmp_cpu_set);
Expand Down

0 comments on commit de82439

Please sign in to comment.