spotify / XCMetrics

XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.
https://xcmetrics.io
Other
1.1k stars 77 forks source link

Upload client stuck when there's no failed upload #37

Closed null09264 closed 2 years ago

null09264 commented 3 years ago

I'm triggering the xcmetric binary through scripts and didn't use the launcher. I notice that occasionally xcmetric runs forever when I trigger it without any new xcactivitylog.

I did a very brief skim on the source code, please kindly correct me if I'm wrong:

In MetricUploaderLogic.swift, it seems both cleanedUpLogs and savedUploadRequests need to be received before we can send mobiusLoopCompleted? For my cases, I never received savedUploadRequests.

Then I trace it back to UploadMetricsEffectHandler.swift, line 42, there's an empty check

if !failedURLs.isEmpty {
    effects.append(.logsUploadFailed(logs: failedURLs))
}

So it seems when nothing fails, the logsUploadFailed will be skipped, and consequently persistNonUploadedLogs will not be triggered, so in the end no savedUploadRequests events will be emitted.

Currently I removed the empty check and it seems to work for my cases now. Have I understood the problem correctly? And will there be any other unwanted side effects if I remove the empty check?

sebskuse commented 3 years ago

We're seeing the same issue. Looks like there's an open PR with a fix for this - https://github.com/spotify/XCMetrics/pull/46, just given it a go and it seems to resolve the issue

polac24 commented 2 years ago

Fixed in #46