spotify / XCRemoteCache

Other
825 stars 50 forks source link

xcactivitylog unexpected end of file #236

Open Coder-Star opened 1 month ago

Coder-Star commented 1 month ago

My integration setup

[✅ ] CocoaPods cocoapods-xcremotecache plugin [ ] Automatic integration using xcprepare integrate ... [ ] Manual integration [ ] Carthage

Expected/desired behavior

Minimal reproduction of the problem with instructions

Producer Logs

 [REPLACE THIS WITH YOUR INFORMATION] 

Consumer Logs

 [REPLACE THIS WITH YOUR INFORMATION] 

Pods/Carthage file

 [REPLACE THIS WITH YOUR INFORMATION] 

Environment

Post build stats

Others

When the consumer hits the cache, The xcactivitylog file is incomplete. When I execute gzip - t xx.xcactivitylog, it prompts unexpected end of file

polac24 commented 1 month ago

Hello! XcRemoteCache doesn’t change anything in the logs area, so it might be either Xcode’s issue or you read the file too early.

  1. Does the file eventually become a valid gzip?
  2. If you fully close Xcode after “cache hit”, does it print logs of the moat recent build?

I know XcMetrics uses a strategy to spin until the file is a valid gzip as Xcode takes some time to serialize everything.

Coder-Star commented 1 month ago

Hello! XcRemoteCache doesn’t change anything in the logs area, so it might be either Xcode’s issue or you read the file too early.

  1. Does the file eventually become a valid gzip?
  2. If you fully close Xcode after “cache hit”, does it print logs of the moat recent build?

I know XcMetrics uses a strategy to spin until the file is a valid gzip as Xcode takes some time to serialize everything.

I know that XcMetrics will wait for a certain amount of time to ensure that the log is fully written. I wait for the log to be fully written before verifying it, and once I close XCRemote Cache, the log will return to normal

polac24 commented 1 month ago

In XCMetrics we don’t wait but spin in a loop https://github.com/spotify/XCMetrics/blob/e1a728a2ca046d8b35a1c4b4f7e04c6758705322/Sources/XCMetricsClient/Log%20Management/LogCopier.swift#L37

If the file eventually becomes a valid zip, you can apply the same strategy.

Coder-Star commented 1 month ago

In XCMetrics we don’t wait but spin in a loop https://github.com/spotify/XCMetrics/blob/e1a728a2ca046d8b35a1c4b4f7e04c6758705322/Sources/XCMetricsClient/Log%20Management/LogCopier.swift#L37

If the file eventually becomes a valid zip, you can apply the same strategy.

I know the principle of XCMetrics, maybe it's because I didn't express myself clearly earlier, and I'm also using XCMetrics.

It's unbelievable that the result did indeed affect me, and I didn't think of any possible reasons

polac24 commented 1 month ago

Get it, didn’t assume you are on XCMetrics.

That looks like an issue with Xcode/Xcmetrics, so I would start with creating a ticket there and/or a feedback to Xcode (however xcactivitylog isn’t a public api).

Coder-Star commented 1 month ago

Get it, didn’t assume you are on XCMetrics.

That looks like an issue with Xcode/Xcmetrics, so I would start with creating a ticket there and/or a feedback to Xcode (however xcactivitylog isn’t a public api).

The main puzzling thing is that once I close the cache, the logs return to normal 😂😂