Diodak
Diodak

Reputation: 1

gen_sctp:open(). returns exception error: bad argument - only for Erlang compiled from sources for Docker Image based on Rocky Linux

I prepared some time ago Docker Container Image based on CentOS 7.9 with erlang-otp build 22.3.4.11 from sources - https://github.com/erlang/otp/releases/download/OTP-22.3.4.11/otp_src-22.3.4.11.tar.gz. All worked fine - as expected:

Erlang/OTP 22 [erts-10.7.2.4] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [hipe]

Eshell V10.7.2.4  (abort with ^G)
1> gen_sctp:open().
{ok,#Port<0.6>}
2>

Now I'm trying to do the same but on Rocky Linux 8.4/8.5 Docker Image and build the same version - 22.3.4.11 from sources. All were successfully compiled on the same server (as CentOS 7.x based Docker Image) but sctp does not work correctly for Rocky Linux Docker based Image only.

Erlang/OTP 22 [erts-10.7.2.4] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [hipe]

Eshell V10.7.2.4  (abort with ^G)
1> gen_sctp:open().
** exception error: bad argument
     in function  gen_sctp:open/1
        called as gen_sctp:open([])
2>

I trying to test also 22.3.4.23 version and the same error were shown.
I also tried install from Rocky RPM packages yum install erlang.x86_64 - 22.0.7-1.el8 and all working fine.
I would to use own compiled version on Rocky to have easy way to update erlang to newer version.

Please let me know what should I do to fix exception error: bad argument for gen_sctp:open(). for Rocky Linux?

Dockerfile for Rocky Linux 8.5/CentOS 7.9.2009:

# For Rocky Linux
FROM rockylinux/rockylinux:8.5
# For CentOS Linux - comment above FROM and uncomment below FROM
# FROM centos:7.9.2009

### Update Image packages
RUN echo 'tsflags=nodocs' >> /etc/yum.conf && \
    yum clean all && \
    yum update -y && \
    yum install -y \
    glibc-langpack-en \
    diffutils \
    findutils \
    wget \
    unzip \
    gcc \
    gcc-c++ \
    autoconf.noarch \
    ncurses-devel \
    make \
    unixODBC-devel.x86_64 \
    lksctp-tools \
    lksctp-tools-devel

ENV ERLANGOTP_VERSION 22.3.4.11
ENV ERLANGOTP_DIR_NAME otp_src_${ERLANGOTP_VERSION}
ENV ERLANGOTP_ARCHIVE otp_src_${ERLANGOTP_VERSION}.tar.gz
RUN wget https://github.com/erlang/otp/releases/download/OTP-${ERLANGOTP_VERSION}/${ERLANGOTP_ARCHIVE} -O /tmp/${ERLANGOTP_ARCHIVE} && \
    tar -xf /tmp/${ERLANGOTP_ARCHIVE} -C /tmp && \
    pushd /tmp/${ERLANGOTP_DIR_NAME} && \
    ./otp_build autoconf && \
    ./configure \
        --enable-sctp \
        --prefix=/usr/local \
        && \
    make -j $(nproc) -l $(nproc) && \
    make install && \
    rm -rf /tmp/${ERLANGOTP_DIR_NAME} /tmp/${ERLANGOTP_ARCHIVE}

Docker build command:
docker build -t erltest:1.0.0 .

Docker run command for tests:
docker run -it --rm erltest:1.0.0 bash
erl
gen_sctp:open().

SCTP Configuration results for CentOS 7.9/Rocky Linux 8.5 Docker Image (in comment found difference for sctp):

checking for netpacket/packet.h... yes
checking for netinet/sctp.h... yes
checking for sctp_bindx... no
checking for sctp_peeloff... no
checking for sctp_getladdrs... no
checking for sctp_freeladdrs... no
checking for sctp_getpaddrs... no
checking for sctp_freepaddrs... no
checking whether SCTP_UNORDERED is declared... yes
checking whether SCTP_ADDR_OVER is declared... yes
checking whether SCTP_ABORT is declared... yes
checking whether SCTP_EOF is declared... yes

# for CentOS 7.x - below:
checking whether SCTP_SENDALL is declared... yes
# for Rocky Linux - below:
checking whether SCTP_SENDALL is declared... no

checking whether SCTP_ADDR_CONFIRMED is declared... yes
checking whether SCTP_DELAYED_ACK_TIME is declared... yes
checking whether SCTP_EMPTY is declared... yes
checking whether SCTP_UNCONFIRMED is declared... yes
checking whether SCTP_CLOSED is declared... yes
checking whether SCTPS_IDLE is declared... no
checking whether SCTP_BOUND is declared... no
checking whether SCTPS_BOUND is declared... no
checking whether SCTP_LISTEN is declared... no
checking whether SCTPS_LISTEN is declared... no
checking whether SCTP_COOKIE_WAIT is declared... yes
checking whether SCTPS_COOKIE_WAIT is declared... no
checking whether SCTP_COOKIE_ECHOED is declared... yes
checking whether SCTPS_COOKIE_ECHOED is declared... no
checking whether SCTP_ESTABLISHED is declared... yes
checking whether SCTPS_ESTABLISHED is declared... no
checking whether SCTP_SHUTDOWN_PENDING is declared... yes
checking whether SCTPS_SHUTDOWN_PENDING is declared... no
checking whether SCTP_SHUTDOWN_SENT is declared... yes
checking whether SCTPS_SHUTDOWN_SENT is declared... no
checking whether SCTP_SHUTDOWN_RECEIVED is declared... yes
checking whether SCTPS_SHUTDOWN_RECEIVED is declared... no
checking whether SCTP_SHUTDOWN_ACK_SENT is declared... yes
checking whether SCTPS_SHUTDOWN_ACK_SENT is declared... no
checking for struct sctp_paddrparams.spp_pathmtu... yes
checking for struct sctp_paddrparams.spp_sackdelay... yes
checking for struct sctp_paddrparams.spp_flags... yes
checking for struct sctp_remote_error.sre_data... yes
checking for struct sctp_send_failed.ssf_data... yes
checking for struct sctp_event_subscribe.sctp_authentication_event... yes
checking for struct sctp_event_subscribe.sctp_sender_dry_event... yes
checking for sched.h... (cached) yes
...
checking ERTS version... 10.7.2.4
checking OTP release... 22
checking OTP version... 22.3.4.11

Upvotes: 0

Views: 220

Answers (1)

Diodak
Diodak

Reputation: 1

I've tested everything again for kernel 4.19.x and 5.15.5 and notice below things:

  1. Red Hat 7.x machine running on kernel 4.19.x:
  • CentOS 7.9 based Docker Image with erlang-otp build 22.3.4.11 from sources - work correctly ({ok,#Port<0.6>})
  • Rocky Linux 8.5 based Docker Image with erlang-otp build 22.3.4.11 from sources - does not work (** exception error: bad argument)
  1. The same Red Hat 7.x machine but running on kernel 5.15.5:
  • CentOS 7.9 based Docker Image with erlang-otp build 22.3.4.11 from sources - work correctly ({ok,#Port<0.6>})
  • Rocky Linux 8.5 based Docker Image with erlang-otp build 22.3.4.11 from sources - work correctly ({ok,#Port<0.6>})

It looks that Docker Image created based on Rocky Linux 8.5 likes modern kernels. Older 4.19.x kernel cause issue but newer 5.15.5 kernel works as expected with the same Rocky Linux 8.5 based Docker Image - I don't know why it fixes problem.

BTW. Default Rocky Linux 8.5 kernel is 4.18.0.

Upvotes: 0

Related Questions