gen_sctp:open(),返回异常错误:参数错误-仅适用于从基于Rocky Linux的Docker Image源代码编译的Erlang

w8f9ii69  于 2022-12-16  发布在  Erlang
关注(0)|答案(1)|浏览(163)

我在一段时间前准备了Docker Container基于CentOS 7.9的映像,使用erlang-otp构建22.3.4.11,来自源代码-https://github.com/erlang/otp/releases/download/OTP-22.3.4.11/otp_src-22.3.4.11.tar.gz

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>

现在,我尝试在Rocky Linux 8.4/8.5Docker映像上执行相同操作,并从源代码构建相同版本-22.3.4.11。所有版本都在同一服务器上成功编译(作为基于CentOS 7.x的Docker映像),但sctp无法正确运行Rocky Linux Docker映像(仅限于基于Rocky Linux Docker的映像)

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>

我尝试测试22.3.4.23版本,显示了相同的错误。
我还尝试安装从洛基RPM包yum install erlang.x86_64-22.0.7-1.el8和所有工作正常。
我会使用自己的编译版本对洛基有简单的方法来更新erlang到较新的版本。
请让我知道我应该做什么来修复exception error: bad argumentgen_sctp:open().为洛基Linux?
适用于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构建命令:
docker build -t erltest:1.0.0 .
用于测试的Docker运行命令:
docker run -it --rm erltest:1.0.0 bash
erl
x1米10英寸1x
CentOS 7.9/Rocky Linux 8.5 Docker映像的SCTP配置结果(在注解中发现了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
pftdvrlh

pftdvrlh1#

我再次测试了内核4.19.x5.15.5的所有内容,并注意到以下内容:
1.在kernel 4.19.x上运行的Red Hat 7.x计算机:

  • 基于CentOS 7.9的Docker映像,使用erlang-OTP从源代码构建22.3.4.11-正常工作{ok,#Port<0.6>}
  • 基于Rocky Linux 8.5的Docker映像,使用erlang-otp从源代码构建22.3.4.11-不工作** exception error: bad argument

1.同一台Red Hat 7.x计算机,但运行在kernel 5.15.5上:

  • 基于CentOS 7.9的Docker映像,使用erlang-otp从源代码构建22.3.4.11-工作正常{ok,#Port<0.6>}
  • 基于Rocky Linux 8.5的Docker映像,使用erlang-OTP构建22.3.4.11(来自源代码)-工作正常{ok,#Port<0.6>}

看起来基于Rocky Linux 8.5创建的Docker映像像现代内核。旧的4.19.x内核导致问题,但新的5.15.5内核与基于相同Rocky Linux 8.5的Docker映像一起按预期工作-我不知道它为什么修复问题。
顺便说一句,默认的Rocky Linux 8.5内核是4.18.0

相关问题