Giter Club home page Giter Club logo

go-message-router's Introduction

Go

go-message-router's People

Contributors

c-monster avatar dannyrandall avatar xuther avatar

Watchers

 avatar  avatar  avatar

go-message-router's Issues

Race condition & Deadlock

Hi there!

I was looking at the packages and decided to run the tests (in race mode) in each. Unfortunately I didn't make it past the router tests before hitting a race condition and a separate deadlock.

The race occurred between:

s.subscriptions = append(s.subscriptions, sub)

and
for _, t := range sub.GetSubscriptions() {

I didn't look into the deadlock, but it occurred during TestLoad, I had to kill the test after 7 minutes.

=== RUN TestLoad
2019/02/27 11:00:31 Testing load
2019/02/27 11:00:31 Publisher: Starting publisher
2019/02/27 11:00:31 Publisher: Publisher ready.
2019/02/27 11:00:31 ERROR starting publisher listener: listen tcp :60010: bind: address already in use
2019/02/27 11:00:31 Starting distribution Channel
2019/02/27 11:00:31 Router: starting router
2019/02/27 11:00:31 Reciever: staring reciever
2019/02/27 11:00:31 Starting distribution Channel
2019/02/27 11:00:31 ERROR starting publisher listener: listen tcp :60011: bind: address already in use
2019/02/27 11:00:31 Starting subscription Manager.
2019/02/27 11:00:31 Reciever: reciever ready
2019/02/27 11:00:31 Reciever: Starting connection with localhost:60010
2019/02/27 11:00:31 Starting subscription Manager.
2019/02/27 11:00:31 Subscribed to localhost:60011.
2019/02/27 11:00:31 Starting listener
2019/02/27 11:00:31 Receiver: subscription to localhost:60010 added
2019/02/27 11:00:31 Subscribed to localhost:60010.
2019/02/27 11:00:31 Starting listener
^Csignal: interrupt
FAIL github.com/xuther/go-message-router/router 436.926s

This may or may not be the cause of this deadlock, but I suspect passing the sync.WaitGroup by value is causing the issue. As the vet tool points out, passing sync types by value results in misuse as the internal data structure is copied and the atomic operations for synchronization no longer work (each goroutine essentially has it's own copy of the WaitGroup, defeating the purpose of the WaitGroup).

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.