Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] Fix java system test on Alpine (musl libc) #1734

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

leki75
Copy link
Contributor

@leki75 leki75 commented Jan 29, 2025

The Java system test fails on the C aeron driver using musl libc, because the error response differs from gnu libc.

#11 454.8     [472.564356562] DRIVER: CMD_OUT_ERROR [320/320]: offendingCommandCorrelationId=4 errorCode=generic error, see message message=(98) Address in use              
#11 454.8     [aeron_bind, aeron_socket.c:93] failed to bind(6, 127.0.0.1:8889)                                                                                              
#11 454.8     [aeron_udp_channel_transport_init, aeron_udp_channel_transport.c:133] unicast bind, affinity=1                                                                 
#11 454.8     [aeron_receive_destination_create, aeron_receive_destination.c:78] uri = aeron:udp?endpoint=localhost:8889                                                     
#11 454.8                                                                                                                                                                    
#11 454.8     [472.566091139] DRIVER: CMD_IN_REMOVE_SUBSCRIPTION [40/40]                                                                                                     
#11 454.8     *** STDERR ***                                                                                                                                                 
#11 454.8     ====                                                                                                                                                           
#11 454.8     *** Complete stack trace:                                                                                                                                      
#11 454.8     java.lang.AssertionError:                                                                                                                                      
#11 454.8     Expected: a string containing "Address already in use"                                                                                                         
#11 454.8          but: was "ERROR - (98) Address in use                                                                                                                     
#11 454.8     [aeron_bind, aeron_socket.c:93] failed to bind(6, 127.0.0.1:8889)                                                                                              
#11 454.8     [aeron_udp_channel_transport_init, aeron_udp_channel_transport.c:133] unicast bind, affinity=1                                                                 
#11 454.8     [aeron_receive_destination_create, aeron_receive_destination.c:78] uri = aeron:udp?endpoint=localhost:8889                                                     
#11 454.8     , errorCodeValue=11"                                                                                                                                           
#11 454.8       at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)                                                                                              
#11 454.8       at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)                                                                                               
#11 454.8       at io.aeron.MultiDestinationSubscriptionTest.shouldNotReuseEndpointAcrossMultipleSubscriptionsIfAtLeastOneIsMds(MultiDestinationSubscriptionTest.java:794)   
#11 454.8       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                            
#11 454.8       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)                                                          
#11 454.8       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                  
#11 454.8       at java.base/java.lang.reflect.Method.invoke(Method.java:569)
...

How to reproduce:

C source code:

#include <errno.h>
#include <string.h>
#include <stdio.h>

int main() {
    printf("%d - %s\n", EADDRINUSE, strerror(EADDRINUSE));
    return 0;
}

Dockerfile.alpine:

FROM alpine:3.21
RUN apk add musl-dev gcc
WORKDIR /usr/local/src/eaddrinuse
COPY eaddrinuse.c .
RUN gcc -o /usr/local/bin/eaddrinuse eaddrinuse.c
CMD ["/usr/local/bin/eaddrinuse"]

Result:

❯ docker buildx build -f Dockerfile.alpine -t eaddrinuse:alpine .
❯ docker run -it --rm eaddrinuse:alpine
98 - Address in use

Same on Debian:

❯ docker buildx build -f Dockerfile.debian -t eaddrinuse:debian .
❯ docker run -it --rm eaddrinuse:debian
98 - Address already in use

@vyazelenko
Copy link
Contributor

@leki75 Thanks for the fix!

@vyazelenko vyazelenko merged commit 8a70fb3 into aeron-io:master Jan 29, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants