Skip to content

Correctly clean up progress bars for completed transfers#2975

Merged
brianaydemir merged 2 commits into
PelicanPlatform:mainfrom
brianaydemir:pbar-leak
Jan 16, 2026
Merged

Correctly clean up progress bars for completed transfers#2975
brianaydemir merged 2 commits into
PelicanPlatform:mainfrom
brianaydemir:pbar-leak

Conversation

@brianaydemir

@brianaydemir brianaydemir commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

Summary

A pelican object sync or pelican object get --recursive involving hundreds of thousands of objects will no longer degrade in performance, as in transfer fewer and fewer objects per unit time, when progress bars are enabled (which is the default).

As a consequence, users might notice that progress bars are no longer displayed at all for transfers that complete under ~0.5 seconds.

Note

There is the potential for a pathological scenario where no progress bars are displayed because all transfers are starting and completing too quickly. The solution for that is to implement an overall status indicator — for example, number of objects transferred out of total number to be transferred — which is out of the scope for this PR.

Details

The linked issue contains a test bench that can be used to verify the fix in this PR, as well as the raw data for the graph below.

The linked issue also contains evidence implicating that the client's handling of progress bars is at fault.

The primary loop is over pb.status:

for path := range pb.status {
if pbMap[path] == nil {
pbMap[path] = &progressBar{

This map is populated via a callback from the transfer jobs, and keyed by the paths of the objects being transferred.

The fundamental problem is we never remove keys from pb.status, so long after the transfer for a path has completed and the progress bar has been removed from the display, we're still updating it:

pbMap[path].bar.EwmaSetCurrent(newStatus.xfer, tickDuration)
pbMap[path].progressStatus = newStatus

The whole business around setting pbMap[path].xfer = -1 should be clearing out progress bars for completed transfers. We need only delete keys from pb.status as appropriate, so that the logic there actually plays out as intended.

And indeed, once we do so, we get a more reasonable behavior:


Screenshot 2026-01-11 at 13 32 51

I would post screenshots of the relevant visualizations from pprof, but I can't find anything significant related to the progress bars anymore, which would suggest that it's below the threshold for caring about.

@brianaydemir brianaydemir added bug Something isn't working client Issue affecting the OSDF client labels Jan 10, 2026
@brianaydemir brianaydemir changed the title Do not create or incrementally update progress bars for "ended" transfers Do not create or update progress bars for completed transfers Jan 11, 2026
@brianaydemir brianaydemir linked an issue Jan 11, 2026 that may be closed by this pull request
@brianaydemir brianaydemir added this to the v7.24 milestone Jan 11, 2026
@brianaydemir brianaydemir force-pushed the pbar-leak branch 2 times, most recently from 1603c7d to 53fc32c Compare January 11, 2026 19:30
@brianaydemir brianaydemir changed the title Do not create or update progress bars for completed transfers Correctly clean up progress bars for completed transfers Jan 11, 2026
@brianaydemir

Copy link
Copy Markdown
Contributor Author

@patrickbrophy You get this one because you mentioned some tool might have observed a problem with our progress bars.

@brianaydemir brianaydemir marked this pull request as ready for review January 11, 2026 20:37
@brianaydemir

Copy link
Copy Markdown
Contributor Author

In the graph above, I believe the extreme downward spikes are correlated with when the client needed to perform another listing (PROPFIND) operation to determine the next chunk of objects to download — and I suppose going through 8192 objects isn't exactly quick.

@patrickbrophy patrickbrophy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix does directly address the cause, however the semantics on the RWLock are now incorrect. Very minor change requested, otherwise LGTM

Comment thread cmd/progress_bars.go Outdated
The user might not have seen them in the console, but the client
was still spending an inordinate amount of resources on them.
@brianaydemir

Copy link
Copy Markdown
Contributor Author

I rebased this on main because I was, locally, I was running into issues with Go 1.24 vs. 1.25.

@patrickbrophy patrickbrophy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@brianaydemir brianaydemir merged commit 6de4bd3 into PelicanPlatform:main Jan 16, 2026
26 of 27 checks passed
@brianaydemir brianaydemir deleted the pbar-leak branch January 16, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working client Issue affecting the OSDF client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client slows down over time when transferring O(100k) objects

2 participants