[GH-ISSUE #416] QueueUpdateDraw & Draw causes deadlock #306

Closed
opened 2026-03-04 01:03:47 +03:00 by kerem · 7 comments
Owner

Originally created by @tryffel on GitHub (Mar 7, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/416

I bisected the commit to fe30520.

I use it as such:

//goroutine1 (same as tview):
Application.Draw()

//goroutine2:
Application.QueueUpdateDraw(func() {...})

Both goroutines are now deadlocked at
application.go:524:

<- ch

Using go1.14 linux/amd64.

Originally created by @tryffel on GitHub (Mar 7, 2020). Original GitHub issue: https://github.com/rivo/tview/issues/416 I bisected the commit to [fe30520](https://github.com/rivo/tview/commit/fe3052019536251fd145835dbaa225b33b7d3088). I use it as such: ``` //goroutine1 (same as tview): Application.Draw() //goroutine2: Application.QueueUpdateDraw(func() {...}) ``` Both goroutines are now deadlocked at application.go:524: ``` <- ch ``` Using go1.14 linux/amd64.
kerem closed this issue 2026-03-04 01:03:48 +03:00
Author
Owner

@SoMuchForSubtlety commented on GitHub (Mar 8, 2020):

I noticed a similar issue.
Previously this worked

func main() {
	app := tview.NewApplication()
	text := tview.NewTextView()
	text.SetChangedFunc(func() { app.Draw() })
	app.SetRoot(text, true)
	fmt.Fprint(text, "text test")
	app.Run()
}

But now it deadlocks.

I also encountered the ChangedFunc app.Draw() locking when the application is running. I will try to reproduce it.

<!-- gh-comment-id:596201047 --> @SoMuchForSubtlety commented on GitHub (Mar 8, 2020): I noticed a similar issue. Previously this worked ```go func main() { app := tview.NewApplication() text := tview.NewTextView() text.SetChangedFunc(func() { app.Draw() }) app.SetRoot(text, true) fmt.Fprint(text, "text test") app.Run() } ``` But now it deadlocks. I also encountered the ChangedFunc `app.Draw()` locking when the application is running. I will try to reproduce it.
Author
Owner

@sarpdoruk commented on GitHub (Mar 10, 2020):

+1 on this.

Having app.Draw() in SetChangedFunc of textView makes whole app crash/freeze/unresponsive.

<!-- gh-comment-id:597306307 --> @sarpdoruk commented on GitHub (Mar 10, 2020): +1 on this. Having `app.Draw()` in `SetChangedFunc` of `textView` makes whole app crash/freeze/unresponsive.
Author
Owner

@rivo commented on GitHub (Apr 4, 2020):

The latest commit fixes the problem in @SoMuchForSubtlety's code but I'm not completely sure if your issues are also fixed. Please let me know so I can close this issue (again).

<!-- gh-comment-id:609086961 --> @rivo commented on GitHub (Apr 4, 2020): The latest commit fixes the problem in @SoMuchForSubtlety's code but I'm not completely sure if your issues are also fixed. Please let me know so I can close this issue (again).
Author
Owner

@tryffel commented on GitHub (May 6, 2020):

Yes it fixed this. Thanks =)

<!-- gh-comment-id:624733977 --> @tryffel commented on GitHub (May 6, 2020): Yes it fixed this. Thanks =)
Author
Owner

@miltalex commented on GitHub (Jun 18, 2020):

The issue persists. Using go1.14.1 darwin/amd64 and tview@fe953220389f

<!-- gh-comment-id:645939003 --> @miltalex commented on GitHub (Jun 18, 2020): The issue persists. Using go1.14.1 darwin/amd64 and tview@fe953220389f
Author
Owner

@rivo commented on GitHub (Aug 18, 2020):

Can you please paste some code that causes this deadlock?

<!-- gh-comment-id:675400117 --> @rivo commented on GitHub (Aug 18, 2020): Can you please paste some code that causes this deadlock?
Author
Owner

@rivo commented on GitHub (Jan 11, 2021):

Please open a new issue and reference this one if you want me to follow up on this topic.

<!-- gh-comment-id:757906043 --> @rivo commented on GitHub (Jan 11, 2021): Please open a new issue and reference this one if you want me to follow up on this topic.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#306
No description provided.