raydac / gosdk-wrapper-maven-plugin

Maven plugin to provide a way to execute GoSDK tools
Apache License 2.0
3 stars 2 forks source link

Golang build getting stuck on big projects #1

Closed sruehl closed 2 months ago

sruehl commented 2 months ago

plc4x recently migrated to the new plugin version. However build is now getting stuck on go fmt ./...

[INFO] --- gosdk-wrapper:1.0.0:execute (default-fmt) @ plc4go ---
[INFO] Prepared command line arguments: [/home/banana/.mvnGoLang/go1.24.0.linux-arm64/bin/go, fmt, ./...]
[INFO] Starting command
[INFO] Process started: PID=1018094, user=banana

Problem can be replicated by

  1. checking out plc4x gh repo clone apache/plc4x,
  2. do a negative test by going to the directory directly cd plc4x/plc4go
  3. run an install ../mvnw install (this should work)
  4. go to the parent directory cd ..
  5. run ./mvnw -P'with-go,skip-bacnet-regression-test,update-generated-code' -X -pl :plc4go install
  6. see that it is getting stuck

when running with -X you can see a bunch of those outputs below. Maybe it is related to the unreleased workdir fix but something I had to add as a config option was <workDir>${project.basedir}</workDir>

[DEBUG] Unable to open symbolic link /proc/639988/exe
[DEBUG] Reading file /proc/639988/io
[DEBUG] Reading file /proc/639988/status
[DEBUG] Reading file /proc/639988/status
[DEBUG] Reading file /proc/639988/stat
[DEBUG] Reading file /proc/639988/stat
[DEBUG] Reading file /proc/1044978/io
[DEBUG] Reading file /proc/1044978/io

And thanks for writing those great maven-plugins. We used the old version for years and recently migrated to the new version which makes calling go tools so much nicer :)

sruehl commented 2 months ago

small note to point 5: omit the -X on first try as it will flood the log otherwise with those proc statements

sruehl commented 2 months ago

and as another note: go fmt ./... completes in a second (go version go1.24.0 linux/arm64)

sruehl commented 2 months ago

small update to 3: you can also provoke that by executing ../mvnw install -Pupdate-generated-code in the plc4go directory directly. It is really odd because like I said running go fmt ./... directly seems to work just fine.

sruehl commented 2 months ago

Update: I found a way to unblock it: If you use the displayed PID and do a tail on it the process continues (e.g. tail -f /proc/1328102/fd/1). It seems there is a underlying issue where the ProcessBuilder doesn't properly connect

sruehl commented 2 months ago

Ok, it is indeed a issue with the way the process is handled, perparing a PR right now

sruehl commented 2 months ago

PR #2 submitted which fixes this issue

raydac commented 2 months ago

Thanks a lot for your PR! I have published plugin with changes in the maven central a 1.0.1 so it should be accessible soon

raydac commented 2 months ago

@sruehl did the release help? p.s. keep in mind that processTimeout in milliseconds, also I would recommend to provide some local GOPATH folder during maven module build and provide it through <env> else default shared folder of GoSDK will be used or predefined in environments

sruehl commented 2 months ago

Yes it helped for Mac and Linux builds but on Windows it fails which might be another bug: Error: Failed to execute goal com.igormaznitsa:gosdk-wrapper-maven-plugin:1.0.1:execute (default-generate) on project plc4go: Execution default-generate of goal com.igormaznitsa:gosdk-wrapper-maven-plugin:1.0.1:execute failed. UnsupportedOperationException -> [Help 1]. I don't have a windows PC at hand, maybe @cdutz can provide some -X info for that.

Thanks for the hint with the timeout, I noticed that too and removed it again (was only used for a quick test anyway).

Is there any downside of using the default shared folder for the GoSDK?

One thing I want to look into at some point is caching for github actions to improve build performance but this is something for another day.

sruehl commented 2 months ago

@raydac created a new issue https://github.com/raydac/gosdk-wrapper-maven-plugin/issues/3

on the jump right now, @cdutz send me a stacktrace which I would need to sanitize but from the looks of it windows doesn't like it when you call that Posix method :)