<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes" -->

---
title: A traffic jam where nobody can move. That’s deadlock....
description: A developer shares their experience encountering a deadlock while working with Go goroutines. Using a four-way traffic intersection as an analogy, the post...
canonical: https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A traffic jam where nobody can move. That’s deadlock. And the fix? | daily.dev
og:description: A developer shares their experience encountering a deadlock while working with Go goroutines. Using a four-way traffic intersection as an analogy, the post...
og:url: https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes
og:image: https://api.daily.dev/og/posts/gecv7HPEs.png
og:image:alt: A traffic jam where nobody can move. That’s deadlock. And the fix?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# A traffic jam where nobody can move. That’s deadlock. And the fix?

**[Medium](https://daily.dev/sources/medium_js)** · 5 min read · 9 upvotes · 1 comments

## Summary

A developer shares their experience encountering a deadlock while working with Go goroutines. Using a four-way traffic intersection as an analogy, the post explains the four conditions required for deadlock, with circular wait being the key one. The core insight is that deadlock prevention through proactive design — specifically consistent lock ordering — is far better than reactive detection and recovery. Just as a roundabout structurally prevents circular traffic jams, enforcing a global lock acquisition order prevents circular waits in concurrent code.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@sundayprincedev/a-traffic-jam-where-nobody-can-move-thats-deadlock-and-the-fix-1fb05e39a118>

## Questions this post answers

### How do I prevent deadlock between goroutines that share resources in Go?

Prevent deadlock by breaking circular wait through consistent lock ordering: have every goroutine acquire shared resources in the same global order, such as always locking Resource 1 before Resource 2. When two goroutines contend for the first lock, one proceeds and the other waits its turn, so no circular dependency can form and the freeze never happens.

_daily.dev surfaces concurrency patterns like this for developers hardening goroutine-based systems against deadlock._

### Can a worker pool with only internal goroutines still deadlock even without external concurrent users?

Yes, worker pools can deadlock purely from internal concurrency. If goroutines in the pool share resources and acquire locks in inconsistent order while processing delegated work, the same circular wait condition that causes deadlock in externally-triggered concurrent systems can occur entirely within the pool, with identical risk and no need for outside traffic.

_developers debugging silent goroutine freezes can find grounded concurrency explanations like this on daily.dev._

## Similar posts on daily.dev

- [Why Deadlocks Freeze Programs Solid](https://daily.dev/posts/why-deadlocks-freeze-programs-solid-uu0kxopqk) · Medium · 0 upvotes · 0 comments
- [Two waiters. One order. One disaster.](https://daily.dev/posts/two-waiters-one-order-one-disaster--7hjqwt8e5) · Medium · 0 upvotes · 0 comments
- [Lock 'Em Dead](https://daily.dev/posts/lock-em-dead-req6ildod) · The Daily WTF · 1 upvotes · 0 comments
- [Deadlock in Java: Examples, Detection, and Prevention](https://daily.dev/posts/deadlock-in-java-examples-detection-and-prevention-kvyshorrf) · DigitalOcean Community · 0 upvotes · 0 comments

---

Tags: [#golang](https://daily.dev/tags/golang)

[View this post on daily.dev](https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"A traffic jam where nobody can move. That’s deadlock. And the fix?","url":"https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes"},"datePublished":"2026-07-25T19:36:17.248Z","dateModified":"2026-09-13T18:40:56.218Z","description":"A developer shares their experience encountering a deadlock while working with Go goroutines. Using a four-way traffic intersection as an analogy, the post...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/145a9bc1dfc438bfe9dcd3f647f99734?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/145a9bc1dfc438bfe9dcd3f647f99734?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":9},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"golang","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"A traffic jam where nobody can move. That’s deadlock. And the fix?"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/a-traffic-jam-where-nobody-can-move-that-s-deadlock-and-the-fix--gecv7hpes#faq","mainEntity":[{"@type":"Question","name":"How do I prevent deadlock between goroutines that share resources in Go?","acceptedAnswer":{"@type":"Answer","text":"Prevent deadlock by breaking circular wait through consistent lock ordering: have every goroutine acquire shared resources in the same global order, such as always locking Resource 1 before Resource 2. When two goroutines contend for the first lock, one proceeds and the other waits its turn, so no circular dependency can form and the freeze never happens. daily.dev surfaces concurrency patterns like this for developers hardening goroutine-based systems against deadlock."}},{"@type":"Question","name":"Can a worker pool with only internal goroutines still deadlock even without external concurrent users?","acceptedAnswer":{"@type":"Answer","text":"Yes, worker pools can deadlock purely from internal concurrency. If goroutines in the pool share resources and acquire locks in inconsistent order while processing delegated work, the same circular wait condition that causes deadlock in externally-triggered concurrent systems can occur entirely within the pool, with identical risk and no need for outside traffic. developers debugging silent goroutine freezes can find grounded concurrency explanations like this on daily.dev."}}]}
```

