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

JAMES-3929 Using http5 client instead of opensearch rest client #1648

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Arsnael
Copy link
Contributor

@Arsnael Arsnael commented Jul 18, 2023

No description provided.

@Arsnael
Copy link
Contributor Author

Arsnael commented Jul 19, 2023

https://ci-builds.apache.org/job/james/job/ApacheJames/job/opensearch-upgrade/1/testReport/junit/org.apache.james.backends.opensearch/OpenSearchIndexerTest/updateMessages/

Seems to be the same issue that @vttranlina encountered... Weird cause when I tested locally quickly yesterday it seemed ok. I will dig more today

@Arsnael
Copy link
Contributor Author

Arsnael commented Jul 20, 2023

Hmmmm seems hanging forever same in some other tests in OpenSearchListeningMessageSearchIndexTest. As soon as you put OS on pause, the requests hangs on forever. Will check the client if we need to configure the timeout or something, related likely to the new Transport class

@chibenwa
Copy link
Contributor

Exception in thread "OpenSearch-driver-3" java.lang.OutOfMemoryError: Java heap space
	at org.apache.hc.core5.util.ByteArrayBuffer.<init>(ByteArrayBuffer.java:54)
	at org.opensearch.client.transport.httpclient5.internal.HeapBufferedAsyncEntityConsumer.data(HeapBufferedAsyncEntityConsumer.java:91)
	at org.apache.hc.core5.http.nio.entity.AbstractBinDataConsumer.consume(AbstractBinDataConsumer.java:75)
	at org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer.consume(AbstractAsyncResponseConsumer.java:141)
	at org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec$1.consume(HttpAsyncMainClientExec.java:227)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamHandler.consumeData(ClientHttp1StreamHandler.java:265)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer.consumeData(ClientHttp1StreamDuplexer.java:354)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onInput(AbstractHttp1StreamDuplexer.java:325)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.inputReady(AbstractHttp1IOEventHandler.java:64)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.inputReady(ClientHttp1IOEventHandler.java:41)
	at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:133)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	at java.base/java.lang.Thread.run(Thread.java:829)

Likely related, and a nice problem to debug!

At your flame graphs / visualvm dumps!

@Arsnael
Copy link
Contributor Author

Arsnael commented Jul 21, 2023

Exception in thread "OpenSearch-driver-3" java.lang.OutOfMemoryError: Java heap space
	at org.apache.hc.core5.util.ByteArrayBuffer.<init>(ByteArrayBuffer.java:54)
	at org.opensearch.client.transport.httpclient5.internal.HeapBufferedAsyncEntityConsumer.data(HeapBufferedAsyncEntityConsumer.java:91)
	at org.apache.hc.core5.http.nio.entity.AbstractBinDataConsumer.consume(AbstractBinDataConsumer.java:75)
	at org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer.consume(AbstractAsyncResponseConsumer.java:141)
	at org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec$1.consume(HttpAsyncMainClientExec.java:227)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamHandler.consumeData(ClientHttp1StreamHandler.java:265)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer.consumeData(ClientHttp1StreamDuplexer.java:354)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onInput(AbstractHttp1StreamDuplexer.java:325)
	at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.inputReady(AbstractHttp1IOEventHandler.java:64)
	at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.inputReady(ClientHttp1IOEventHandler.java:41)
	at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:133)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	at java.base/java.lang.Thread.run(Thread.java:829)

Likely related, and a nice problem to debug!

At your flame graphs / visualvm dumps!

I guessed with what I saw with perf tests yesterday... I had 9000+ users (10k users total) hanging at the end of the imap simulation...

I wanted to do some dumps and graphs today but well... can't access the perf test VM for now

@vttranlina
Copy link
Contributor

hanging at the end of the imap simulation...

not related but don't forget the MAX_DURATION env variable

@Arsnael
Copy link
Contributor Author

Arsnael commented Jul 21, 2023

hanging at the end of the imap simulation...

not related but don't forget the MAX_DURATION env variable

I didn't and the simulation finished because of it. But when before finishing you see more than 9k users are still hanging, you know something is wrong :)

@chibenwa
Copy link
Contributor

What is the status of this work?

@Arsnael
Copy link
Contributor Author

Arsnael commented Aug 17, 2023

What is the status of this work?

Couldn't find a way to solve it

Comment on lines 74 to 79
<!-- Needed for opensearch-java dependency -->
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.1.4</version>
</dependency>
<!-- Needed for opensearch-java dependency -->
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.1.5</version>
</dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versions are not the same. Is this intendeed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Just took what was on the java opensearch client side. If you look at the respective versions at maven central as well, you can see those two libs are not strictly coupled:

You can see there is no 5.1.5 version for httpclient5, it stops at 1.5.4 (similar with the current 5.2.x upper version actually)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

httpcore5 is brought by httpclient5 cf https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5/5.1.4

IMO we do not need this dependency explicilty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do a stricter dependency analysis with maven: mvn dependency:tree -Dverbose in this module

(ad put the resulting output in a TXT file here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a try, forgot which one I added first back then to see the compiler still crying something was missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot where I found that last time but I remember the scope of those deps in opensearch-java client was runtime, as you can see here:
deps.txt

Agreed that httpclient5 brings along httpcore5 though, unecessary indeed

Copy link
Contributor

@chibenwa chibenwa Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts:

[INFO] |  +- org.opensearch.client:opensearch-rest-client:jar:2.7.0:runtime
[INFO] |  |  +- (org.apache.httpcomponents:httpclient:jar:4.5.14:runtime - version managed from 4.5.13; omitted for duplicate)

Likey an issue... The offender is restassured. Please force this dependency, no need to specify the version as we manage it in the root POM.

Idem forcethe version of httpcore to 4.4.16...

The conflict likely occurs because of restassured thus that would be why the leakwould only happen in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure to get it..? httpclient5 and httpcore5 are different libs from httpcore and httpclient? They even have different group ids. I don't see the correlation here

Reminder that the leak blew up in my face big time during perf tests on sandbox, so not only happening in our test suite

Or did i miss something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see dependencies between them. Not as unlinked as one might think...

@Arsnael Arsnael changed the title JAMES-3929 Upgrade to opensearch-java 2.6.0 JAMES-3929 Using http5 client instead of opensearch rest client Feb 5, 2024
@Arsnael
Copy link
Contributor Author

Arsnael commented Feb 5, 2024

Hoping that the lib update fixes the previous encountered issues.

I didn't seem to encounter anymore the issue we had before on OpenSearchListeningMessageSearchIndexTest when putting OS on pause.

Still needs of course to be perf tested before being potentially approved/merged.

Copy link
Contributor

@quantranhong1999 quantranhong1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read it

@Arsnael
Copy link
Contributor Author

Arsnael commented Feb 7, 2024

Green... I guess it's time to see the perf side of things :)

@chibenwa
Copy link
Contributor

chibenwa commented Feb 7, 2024

Don't forget to pick a scenario where OpenSearch is actually called...

@Arsnael
Copy link
Contributor Author

Arsnael commented Feb 7, 2024

Don't forget to pick a scenario where OpenSearch is actually called...

The full platform scenarii actually do call them... among other things. Thinking it's good enough for a first run at it.

Have something more specific in mind maybe to push it further on a 2nd test run?

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.

4 participants