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

codesign randomly hangs forever when building the app #309

Closed
jagthedrummer opened this issue Mar 15, 2024 · 4 comments
Closed

codesign randomly hangs forever when building the app #309

jagthedrummer opened this issue Mar 15, 2024 · 4 comments

Comments

@jagthedrummer
Copy link

jagthedrummer commented Mar 15, 2024

I have an electron app that I build in GitHub Actions and every now and then, seemingly randomly, builds will stall and never complete the very first codesign operation.

When things work correctly the first codesign call happens in a fraction of a second, and then it continues walking the tree and calling codesign for hundreds of other files.

When the problem occurs the first codesign call stalls for up to 20 or 30 minutes (depending on the timeout set for the GitHub Action) and never finishes.

Here are the last few lines from a stalled build:

Fri, 15 Mar 2024 17:39:00 GMT 2024-03-15T17:39:00.334Z electron-osx-sign Signing application... 
Fri, 15 Mar 2024 17:39:00 GMT  > Application: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-53D8OG/Seshy_development.app 
Fri, 15 Mar 2024 17:39:00 GMT  > Platform: darwin 
Fri, 15 Mar 2024 17:39:00 GMT  > Additional binaries: undefined 
Fri, 15 Mar 2024 17:39:00 GMT  > Identity: Developer ID Application: Jeremy Green (***)
Fri, 15 Mar 2024 17:39:00 GMT 2024-03-15T17:39:00.334Z electron-osx-sign Walking... /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-53D8OG/Seshy_development.app/Contents
Fri, 15 Mar 2024 17:39:00 GMT 2024-03-15T17:39:00.381Z electron-osx-sign Signing... /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-53D8OG/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak
Fri, 15 Mar 2024 17:39:00 GMT 2024-03-15T17:39:00.382Z electron-osx-sign Executing... codesign --sign XXXX --force --timestamp --options runtime --entitlements /Users/runner/work/seshy/seshy/electron-app/node_modules/@electron/osx-sign/entitlements/default.darwin.plist /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-53D8OG/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak
Fri, 15 Mar 2024 18:02:37 GMT Error: The operation was canceled.

And here's what a successful build looks like in that same bit of the log:

Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.552Z electron-osx-sign Signing application... 
Mon, 19 Feb 2024 15:46:59 GMT  > Application: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app 
Mon, 19 Feb 2024 15:46:59 GMT  > Platform: darwin 
Mon, 19 Feb 2024 15:46:59 GMT  > Additional binaries: undefined 
Mon, 19 Feb 2024 15:46:59 GMT  > Identity: Developer ID Application: Jeremy Green (***)
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.553Z electron-osx-sign Walking... /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.621Z electron-osx-sign Signing... /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.621Z electron-osx-sign Executing... codesign --sign XXXXX --force --timestamp --options runtime --entitlements /Users/runner/work/seshy/seshy/electron-app/node_modules/@electron/osx-sign/entitlements/default.darwin.plist /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.864Z electron-osx-sign Signing... /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/locale.pak
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.864Z electron-osx-sign Executing... codesign --sign XXXXX --force --timestamp --options runtime --entitlements /Users/runner/work/seshy/seshy/electron-app/node_modules/@electron/osx-sign/entitlements/default.darwin.plist /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/locale.pak
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.974Z electron-osx-sign Signing... /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ar.lproj/locale.pak
Mon, 19 Feb 2024 15:46:59 GMT 2024-02-19T15:46:59.974Z electron-osx-sign Executing... codesign --sign XXXXX --force --timestamp --options runtime --entitlements /Users/runner/work/seshy/seshy/electron-app/node_modules/@electron/osx-sign/entitlements/default.darwin.plist /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-arm64/Seshy_development-darwin-arm64-ig7Gl5/Seshy_development.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ar.lproj/locale.pak
# snip hundreds more Signing => Executing steps

This seems similar to an issue reported a while back on the electron/packager project: electron/packager#701

But I already have the suggested solution as part of my keychain setup script.

And the problem I'm running into isn't persistent. Most of the time my builds work as expected. When the problem occurs usually it will fail a time or two (or more 😞) and then eventually work after some retries.

I've also set DEBUG=electron-osx-sign in my environment, but I'm not sure if I'm getting debug output from electron/osx-sign. (Maybe some of what I posted above is the debug output?)

@albireox
Copy link

I'm seeing what seems to be the exact same issue. When I package my app with electron-forge (which calls electron-osx-sign under the hood) in my local computer the signing works 100% of the time. But inside a GitHub workflow it's a toss. I'd say it hangs 80% of the time, but sometimes it just works.

Any suggestions would be appreciated.

@albireox
Copy link

Actually I think I was able to solve this by using this action (or potentially this fork with the update for Node 20).

Before I was essentially running this script which I'm not very sure where I copied from, but there are many places with similar instructions.

After migrating to the Github Action instead of the script everything works fine. My guess is that there's something in the codesign process that by default requires user interaction and that the action correctly disables while the script does not.

@VerteDinde
Copy link
Member

Glad this is fixed!

@jagthedrummer
Copy link
Author

@VerteDinde I don't think this is fixed. I'm still having this problem from time to time.

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

No branches or pull requests

3 participants