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

rabbitmq - integration test SendMessageRabbitmqIT is broken #143

Open
pmauduit opened this issue Sep 11, 2024 · 1 comment
Open

rabbitmq - integration test SendMessageRabbitmqIT is broken #143

pmauduit opened this issue Sep 11, 2024 · 1 comment

Comments

@pmauduit
Copy link
Member

Noticed here:
#142 (comment)

I first thought it was because console docker logging changed in newer versions of the image, as the test result relies on it, but turned out it might be related to a spring upgrade console-side:

--- console: 2024-09-11 09:27:12 SimpleMessageListenerContainer [WARN] Execution of Rabbit message listener failed, and no ErrorHandler has been set.
--- console: java.lang.NoSuchMethodError: 'byte[] org.springframework.amqp.core.MessageProperties.getCorrelationId()'
--- console: 	at org.springframework.amqp.rabbit.support.DefaultMessagePropertiesConverter.fromMessageProperties(DefaultMessagePropertiesConverter.java:107)
--- console: 	at org.springframework.amqp.rabbit.core.RabbitTemplate.doSend(RabbitTemplate.java:646)
--- console: 	at org.springframework.amqp.rabbit.core.RabbitTemplate$1.doInRabbit(RabbitTemplate.java:331)
--- console: 	at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:600)
--- console: 	at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:329)
--- console: 	at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:358)
--- console: 	at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:346)
--- console: 	at org.georchestra.console.events.RabbitmqEventsSender.sendAcknowledgementMessageToGateway(RabbitmqEventsSender.java:30)
--- console: 	at org.georchestra.console.events.RabbitmqEventsListener.onMessage(RabbitmqEventsListener.java:67)
[...]

Maybe we are better off deactivating this test for now, as it breaks the build on something which has to be fixed console-side.

@pmauduit
Copy link
Member Author

Also maybe we should make the test rely on the LDAP content (e.g. check if the user has been created) instead of parsing container's stdout.

pmauduit added a commit that referenced this issue Sep 11, 2024
Check the account creation onto the LDAP instead of parsing the console
output.
pmauduit added a commit to georchestra/georchestra that referenced this issue Sep 11, 2024
1. Fixing version mismatch between dependencies in the pom

Some weeks ago, a version bump of `spring-amqp` broke the rabbitmq
integration (see CICD of the gateway and
georchestra/georchestra-gateway#143 for the
details). While digging into the issue, it turned out that PR#4295
upgraded the dependency to a version non compatible with
`spring-rabbitmq`, which generated a docker image for the console which
won't be viable in regards to the rabbitmq integration.

spring-rabbitmq already depends on spring-amqp, which by the way should
be forced into a specific version somewhere else. Sticking to
1.7.12.RELEASE of spring-rabbit, so that we keep a compatible version
with amqp.

2. Rework console message consumption

When a user account from a third-party oauth2 identity provider is saved
into the LDAP (at first connection through the gateway), a message is
sent via rabbitMq and consumed by the console.

In order to avoid consumption of the same message several times, a
`Set<String>` was created as a static member of the
`RabbitmqEventsListener` class. But if an exception popped before
reaching the call to add the message uid to the list, then the
`onMessage` method was then called once again, in a kind of infinite
loop.

We had some issues with one of the external service recently on one of
our infrastructure, and we suspect that this behaviour generated a huge
amount of unecessary logs because of this infinite loop.

This PR suggests to rewrite the `onMessage()` in the following way:

* removing the `Set<String>` (what will it look like in some centuries
  of console uptime ?)
* log the error to the logs
* discards the message (by simply returning from the onMessage() without
  throwing any exception

3. tests

Added an IT, which was the reason leading to the 2. above

Tests: Added an integration test (along with a dependency against
testcontainers). This is a first step to integrate the library and drop
the IT dedicated docker composition.

Caveat: we are late on the spring-amqp/rabbit version, but at least
we will have a test ready when we will go for a version bump.
pmauduit added a commit to georchestra/georchestra that referenced this issue Sep 11, 2024
1. Fixing version mismatch between dependencies in the pom

Some weeks ago, a version bump of `spring-amqp` broke the rabbitmq
integration (see CICD of the gateway and
georchestra/georchestra-gateway#143 for the
details). While digging into the issue, it turned out that PR#4295
upgraded the dependency to a version non compatible with
`spring-rabbitmq`, which generated a docker image for the console which
won't be viable in regards to the rabbitmq integration.

spring-rabbitmq already depends on spring-amqp, which by the way should
be forced into a specific version somewhere else. Sticking to
1.7.12.RELEASE of spring-rabbit, so that we keep a compatible version
with amqp.

2. Rework console message consumption

When a user account from a third-party oauth2 identity provider is saved
into the LDAP (at first connection through the gateway), a message is
sent via rabbitMq and consumed by the console.

In order to avoid consumption of the same message several times, a
`Set<String>` was created as a static member of the
`RabbitmqEventsListener` class. But if an exception popped before
reaching the call to add the message uid to the list, then the
`onMessage` method was then called once again, in a kind of infinite
loop.

We had some issues with one of the external service recently on one of
our infrastructure, and we suspect that this behaviour generated a huge
amount of unecessary logs because of this infinite loop.

This PR suggests to rewrite the `onMessage()` in the following way:

* removing the `Set<String>` (what will it look like in some centuries
  of console uptime ?)
* log the error to the logs
* discards the message (by simply returning from the onMessage() without
  throwing any exception

3. tests

Added an IT, which was the reason leading to the 2. above

Tests: Added an integration test (along with a dependency against
testcontainers). This is a first step to integrate the library and drop
the IT dedicated docker composition.

Caveat: we are late on the spring-amqp/rabbit version, but at least
we will have a test ready when we will go for a version bump.
pmauduit added a commit to georchestra/georchestra that referenced this issue Sep 11, 2024
1. Fixing version mismatch between dependencies in the pom

Some weeks ago, a version bump of `spring-amqp` broke the rabbitmq
integration (see CICD of the gateway and
georchestra/georchestra-gateway#143 for the
details). While digging into the issue, it turned out that PR#4295
upgraded the dependency to a version non compatible with
`spring-rabbitmq`, which generated a docker image for the console which
won't be viable in regards to the rabbitmq integration.

spring-rabbitmq already depends on spring-amqp, which by the way should
be forced into a specific version somewhere else. Sticking to
1.7.12.RELEASE of spring-rabbit, so that we keep a compatible version
with amqp.

2. Rework console message consumption

When a user account from a third-party oauth2 identity provider is saved
into the LDAP (at first connection through the gateway), a message is
sent via rabbitMq and consumed by the console.

In order to avoid consumption of the same message several times, a
`Set<String>` was created as a static member of the
`RabbitmqEventsListener` class. But if an exception popped before
reaching the call to add the message uid to the list, then the
`onMessage` method was then called once again, in a kind of infinite
loop.

We had some issues with one of the external service recently on one of
our infrastructure, and we suspect that this behaviour generated a huge
amount of unecessary logs because of this infinite loop.

This PR suggests to rewrite the `onMessage()` in the following way:

* removing the `Set<String>` (what will it look like in some centuries
  of console uptime ?)
* log the error to the logs
* discards the message (by simply returning from the onMessage() without
  throwing any exception

3. tests

Added an IT, which was the reason leading to the 2. above

Tests: Added an integration test (along with a dependency against
testcontainers). This is a first step to integrate the library and drop
the IT dedicated docker composition.

Caveat: we are late on the spring-amqp/rabbit version, but at least
we will have a test ready when we will go for a version bump.
pmauduit added a commit to georchestra/georchestra that referenced this issue Sep 11, 2024
1. Fixing version mismatch between dependencies in the pom

Some weeks ago, a version bump of `spring-amqp` broke the rabbitmq
integration (see CICD of the gateway and
georchestra/georchestra-gateway#143 for the
details). While digging into the issue, it turned out that PR#4295
upgraded the dependency to a version non compatible with
`spring-rabbitmq`, which generated a docker image for the console which
won't be viable in regards to the rabbitmq integration.

spring-rabbitmq already depends on spring-amqp, which by the way should
be forced into a specific version somewhere else. Sticking to
1.7.12.RELEASE of spring-rabbit, so that we keep a compatible version
with amqp.

2. Rework console message consumption

When a user account from a third-party oauth2 identity provider is saved
into the LDAP (at first connection through the gateway), a message is
sent via rabbitMq and consumed by the console.

In order to avoid consumption of the same message several times, a
`Set<String>` was created as a static member of the
`RabbitmqEventsListener` class. But if an exception popped before
reaching the call to add the message uid to the list, then the
`onMessage` method was then called once again, in a kind of infinite
loop.

We had some issues with one of the external service recently on one of
our infrastructure, and we suspect that this behaviour generated a huge
amount of unecessary logs because of this infinite loop.

This PR suggests to rewrite the `onMessage()` in the following way:

* removing the `Set<String>` (what will it look like in some centuries
  of console uptime ?)
* log the error to the logs
* discards the message (by simply returning from the onMessage() without
  throwing any exception

3. tests

Added an IT, which was the reason leading to the 2. above

Tests: Added an integration test (along with a dependency against
testcontainers). This is a first step to integrate the library and drop
the IT dedicated docker composition.

Caveat: we are late on the spring-amqp/rabbit version, but at least
we will have a test ready when we will go for a version bump.
github-actions bot pushed a commit to georchestra/georchestra that referenced this issue Sep 30, 2024
1. Fixing version mismatch between dependencies in the pom

Some weeks ago, a version bump of `spring-amqp` broke the rabbitmq
integration (see CICD of the gateway and
georchestra/georchestra-gateway#143 for the
details). While digging into the issue, it turned out that PR#4295
upgraded the dependency to a version non compatible with
`spring-rabbitmq`, which generated a docker image for the console which
won't be viable in regards to the rabbitmq integration.

spring-rabbitmq already depends on spring-amqp, which by the way should
be forced into a specific version somewhere else. Sticking to
1.7.12.RELEASE of spring-rabbit, so that we keep a compatible version
with amqp.

2. Rework console message consumption

When a user account from a third-party oauth2 identity provider is saved
into the LDAP (at first connection through the gateway), a message is
sent via rabbitMq and consumed by the console.

In order to avoid consumption of the same message several times, a
`Set<String>` was created as a static member of the
`RabbitmqEventsListener` class. But if an exception popped before
reaching the call to add the message uid to the list, then the
`onMessage` method was then called once again, in a kind of infinite
loop.

We had some issues with one of the external service recently on one of
our infrastructure, and we suspect that this behaviour generated a huge
amount of unecessary logs because of this infinite loop.

This PR suggests to rewrite the `onMessage()` in the following way:

* removing the `Set<String>` (what will it look like in some centuries
  of console uptime ?)
* log the error to the logs
* discards the message (by simply returning from the onMessage() without
  throwing any exception

3. tests

Added an IT, which was the reason leading to the 2. above

Tests: Added an integration test (along with a dependency against
testcontainers). This is a first step to integrate the library and drop
the IT dedicated docker composition.

Caveat: we are late on the spring-amqp/rabbit version, but at least
we will have a test ready when we will go for a version bump.

(cherry picked from commit 26dbbf4)
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

No branches or pull requests

1 participant