Code Monkey home page Code Monkey logo

pusher's Introduction

pusher's People

Contributors

frekw avatar hrydgard avatar lindroth avatar pettermachado avatar svenw avatar zond avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pusher's Issues

cleanupTimer in terminate() is not thread safe.

terminate() is called by 3 diffrent defere states, and will run about the same time.

WARNING: DATA RACE
Read by goroutine 54:
github.com/zond/pusher/hub.(_Session).terminate()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:434 +0x2a0
github.com/zond/pusher/hub.(_Session).Handle()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:481 +0x628
github.com/zond/pusher/hub.(_Session).handleWS()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:440 +0xd1
github.com/zond/pusher/hub._Session.(github.com/zond/pusher/hub.handleWS)·fm()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:192 +0x3d
code.google.com/p/go.net/websocket.Server.serveWebSocket()
/Users/jimmywennlund/go/src/code.google.com/p/go.net/websocket/server.go:98 +0x279
code.google.com/p/go.net/websocket.Handler.ServeHTTP()
/Users/jimmywennlund/go/src/code.google.com/p/go.net/websocket/server.go:121 +0xad
github.com/zond/pusher/hub.(_Server).ServeHTTP()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:192 +0x35b
net/http.serverHandler.ServeHTTP()
/usr/local/go/src/pkg/net/http/server.go:1597 +0x1ca
net/http.(_conn).serve()
/usr/local/go/src/pkg/net/http/server.go:1167 +0xc00

Previous write by goroutine 61:
github.com/zond/pusher/hub.(_Session).terminate()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:435 +0x36c
github.com/zond/pusher/hub.(_Session).writeLoop()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:304 +0x3a7

Goroutine 54 (running) created at:
net/http.(_Server).Serve()
/usr/local/go/src/pkg/net/http/server.go:1644 +0x2c1
net/http.(_Server).ListenAndServe()
/usr/local/go/src/pkg/net/http/server.go:1612 +0xc0
net/http.ListenAndServe()
/usr/local/go/src/pkg/net/http/server.go:1677 +0xb7
main.main()
/Users/jimmywennlund/go/src/github.com/zond/pusher/pusher_server/pusher_server.go:18 +0x39b

Goroutine 61 (finished) created at:
github.com/zond/pusher/hub.(_Session).Handle()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:458 +0x368
github.com/zond/pusher/hub.(_Session).handleWS()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:440 +0xd1
github.com/zond/pusher/hub._Session.(github.com/zond/pusher/hub.handleWS)·fm()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:192 +0x3d
code.google.com/p/go.net/websocket.Server.serveWebSocket()
/Users/jimmywennlund/go/src/code.google.com/p/go.net/websocket/server.go:98 +0x279
code.google.com/p/go.net/websocket.Handler.ServeHTTP()
/Users/jimmywennlund/go/src/code.google.com/p/go.net/websocket/server.go:121 +0xad
github.com/zond/pusher/hub.(_Server).ServeHTTP()
/Users/jimmywennlund/go/src/github.com/zond/pusher/hub/hub.go:192 +0x35b
net/http.serverHandler.ServeHTTP()
/usr/local/go/src/pkg/net/http/server.go:1597 +0x1ca
net/http.(*conn).serve()
/usr/local/go/src/pkg/net/http/server.go:1167 +0xc00

Don't use functions as a key in a hashmap

...since JS doesn't have proper hashmaps pre-ES6, all maps use string based keys.

If the function is JITed, its toString signature will be something similar to function(){ [native code] } which means we can't pick up a reference to it again.

In this case, it's safer to rely on subscriptions[uri] = []; and use [].indexOf to pick up the correct index.

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.