Skip to content

Conversation

@alecgrieser
Copy link
Collaborator

This updates the logic in the publishMavenCentralBundle task so that it no longer loads the full contents of the file into memory. It does this by maintaining a buffer and then writing the contents of the buffer into the stream, which allows us to avoid materializing the full element into memory. This is to try and fix a Java heap memory error that we saw previously (see: https://github.com/FoundationDB/fdb-record-layer/actions/runs/19108664941/job/54605649248).

While I was here, I also updated the boundary for the HTTP multi-part form from the current time millis to a UUID, in response to a comment from the previous PR (#3723 (comment)).

This updates the logic in the `publishMavenCentralBundle` task so that it no longer loads the full contents of the file into memory. It does this by maintaining a buffer and then writing the contents of the buffer into the stream, which allows us to avoid materializing the full element into memory. This is to try and fix a Java heap memory error that we saw previously (see: https://github.com/FoundationDB/fdb-record-layer/actions/runs/19108664941/job/54605649248).

While I was here, I also updated the boundary for the HTTP multi-part form from the current time millis to a UUID, in response to a comment from the previous PR (FoundationDB#3723 (comment)).
@alecgrieser alecgrieser added the build improvement Improvement to the build system label Nov 5, 2025
build.gradle Outdated
// Stream the file in chunks to avoid loading it all into memory
bundleFile.withInputStream { input ->
connection.outputStream << input
byte[] buffer = new byte[8192]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking into it, I think the << does this already.... https://github.com/apache/groovy/blob/GROOVY_3_0_22/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L206

I think the actual problem is that if you are not streaming, HTTPUrlConnection will use a PosterOutputStream which is ByteArrayOutputStream.

I think you need to call setChunkedStreamingMode​(int chunklen) or setFixedLengthStreamingMode​(long contentLength)

I think we should be able to calculate the content length if you first convert the header and footer to byte[].

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, sure. I can give that a shot

@alecgrieser alecgrieser merged commit f161cbc into FoundationDB:main Nov 5, 2025
8 checks passed
@alecgrieser alecgrieser deleted the use-multipart-more-explicitly branch November 5, 2025 19:50
alecgrieser added a commit to alecgrieser/fdb-record-layer that referenced this pull request Nov 6, 2025
arnaud-lacurie pushed a commit that referenced this pull request Nov 7, 2025
This reverts #3723 and #3724 and returns us back to publishing via the
nexus publishing API. The impetus for this is that the last approach got
stuck in a publishing state after the upload (see:
https://github.com/FoundationDB/fdb-record-layer/actions/runs/19117047380/job/54633288001,
which succeeded, but for which we didn't get artifacts actually
published despite the server upload succeeding).

When we are in this mode, we expect the build to fail with a 400 error
letting us know that we didn't upload anything. However, if we didn't
`close` the staging repositories (which is the step that is failing),
then legacy API would not be expected to upload anything to the central
repo. So we need to continue to do that part even though we think it
will fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build improvement Improvement to the build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants