You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "zJiaJun (via GitHub)" <gi...@apache.org> on 2025/04/21 12:44:36 UTC
[I] [Bug] Runtime instrumentation check for newproc1 parameters incorrect for Go 1.23+ [skywalking]
zJiaJun opened a new issue, #13188:
URL: https://github.com/apache/skywalking/issues/13188
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
### Apache SkyWalking Component
Go Agent (apache/skywalking-go)
### What happened
In skywalking-go v0.5.0, the runtime instrumentation logic for Go versions 1.23 and later appears to be incomplete. Specifically, the check for the number of parameters in the internal runtime.newproc1 function is incorrect, causing the automatic context propagation logic for new goroutines to be skipped during instrumentation.
Details:
Agent Version: apache/skywalking-go v0.5.0 (which claims support for Go 1.23 via PR #192)
Go Version: Tested on Go 1.24.2 (issue applies to Go 1.23+)
File: tools/go-agent/instrument/runtime/instrument.go
Function: FilterAndEdit method of the runtime.Instrument struct.
Problem: When processing the AST for the runtime.newproc1 function, the code explicitly checks if len(n.Type.Params.List) != 3.
Discrepancy: As confirmed by Go source code 1, newproc1 in Go 1.23 and later versions actually has 5 parameters.
Consequence: Because 5 != 3, the check evaluates to true, causing the FilterAndEdit function to return false immediately for the newproc1 node.
Impact: This prevents the subsequent call to tools.InsertStmtsBeforeBody from executing. This specific call is responsible for injecting the defer statement that handles automatic context propagation when a new goroutine is created via newproc1.
Observation: Debugging confirms that this check fails for the 5-parameter newproc1 AST node and the injection code is skipped. While PR #192 addressed other Go 1.23 compatibility issues (like internal/atomic path), it did not modify this specific parameter check.
### What you expected to happen
When using skywalking-go agent v0.5.0 with Go 1.23 or Go 1.24, the runtime instrumentation (tools/go-agent/instrument/runtime/instrument.go) should correctly identify the runtime.newproc1 function, regardless of its parameter count (which is 5 in these Go versions).
Consequently, the agent should successfully inject the defer statement into newproc1's body. This injected code is crucial for automatically propagating the SkyWalking tracing context when new goroutines are created.
The expected outcome is seamless, automatic context propagation across goroutines initiated via the standard go keyword, without requiring manual context handling in user code for this specific scenario.
### How to reproduce
Environment:
Go version: 1.23.x or 1.24.x (e.g., 1.24.2)
skywalking-go agent: v0.5.0 (built from source or downloaded binary)
Operating System: Any (e.g., macOS arm64, Linux amd64)
### Anything else
_No response_
### Are you willing to submit a pull request to fix on your own?
- [x] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Runtime instrumentation check for newproc1 parameters incorrect for Go 1.23+ [skywalking]
Posted by "zJiaJun (via GitHub)" <gi...@apache.org>.
zJiaJun commented on issue #13188:
URL: https://github.com/apache/skywalking/issues/13188#issuecomment-2818349798
> Are you going to submit the patch for this?
Yes, I plan to work on a patch for this issue. I'll start looking into the runtime.Instrument code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Runtime instrumentation check for newproc1 parameters incorrect for Go 1.23+ [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on issue #13188:
URL: https://github.com/apache/skywalking/issues/13188#issuecomment-2818343530
Are you going to submit the patch for this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Runtime instrumentation check for newproc1 parameters incorrect for Go 1.23+ [skywalking]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu closed issue #13188: [Bug] Runtime instrumentation check for newproc1 parameters incorrect for Go 1.23+
URL: https://github.com/apache/skywalking/issues/13188
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org