Comments (6)
Minimized the example too much. This one shows the same behaviour and makes it more obvious why next
shouldn't hang.
package main
import "fmt"
func count(ch chan <- int) {
x := 0
for {
ch <- x
tmp := x
tmp += 1
x = tmp
}
}
func main() {
ch := make(chan int)
go count(ch)
for {
====> x := <- ch
fmt.Println(x)
}
}
from delve.
Hmm.. I have an idea why this may be happening. Thanks for the error reproducing code. I'll wrap a test around this and start working on a fix.
from delve.
Did not mean for the last push to close this -- reopening as it's occasionally still an issue.
from delve.
@derekparker I think the issue is with how you are stepping forward threads that are currently blocked waiting for a resource. I have been working on a project (https://github.com/cam72cam/burrow) to create a ncurses interface for delve. Here is the output of program posted above.
https://gfycat.com/ImpoliteLastBushsqueaker#
The gify came out a bit funny, so here are the commands to replicate
:break main.main
:break fmt.Println
:continue
:continue
:continue
:continue
s (next key)
s (next key)
s (next key)
The continue runs to the next breakpoint and only the main thread's context changes there.
When you call Next() on all of the threads, the ones that I think are blocking/waiting (runtime.usleep) are forced forward which causes something to go wrong.
from delve.
@cam72cam that's definitely the issue, and was solved partly by a recent commit last night which enabled next
to handle goroutine thread context switching a little better.
There are certainly issues where Delve can continue a thread (M) that is blocked waiting for a G - which can cause Delve to hang. I'm thinking through some solutions to this problem and I have some experimental fixes hanging around on another branch. There are some fun and interesting problems around how to coordinate threads in such a way that the scheduler thread on the traced process is still able to do its job.
from delve.
Seems fixed as of afa3a9c. Thanks
from delve.
Related Issues (20)
- Delve is incompatible with musl system loader
- Problem when debugging code using golang.org/x/sys/windows HOT 3
- `DELVE_EDITOR` should support extra arguments HOT 1
- ARM64 call method which relative offset is out of range of CALL instruction. HOT 8
- Support call injection for functions that have type parameters HOT 2
- Add installation note that build requires CGO
- golang cannot debug HOT 2
- [BUG]Unable to perform single-step debugging HOT 11
- panic incorrectly attributed to wrong line
- "not an executable file" when exec an exe file which has been modified by UpdateResourceA API HOT 5
- "empty OP stack" for values running `dlv test` HOT 9
- Breakpoint ignored due to "protocol error E09 during set breakpoint for packet" error HOT 2
- Unpredictable debugger link error HOT 2
- (*LineTable).funcName() causes panic: runtime error: slice bounds out of range [795306342:43562440] HOT 3
- debug with dlv can't continue on panics+defer recover properly HOT 1
- feature request: option to disable unrecovered panic breakpoint HOT 2
- Feature request: Make it possible to listen on a Unix Domain Socket HOT 1
- unix domain sockets only work in headless mode without --continue flag
- Highlight (new) AGPL (Affero General Public License dependency go-delve/gore HOT 3
- layer=dap runtime error: protocol error E32 during register write for packet $P10 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delve.