Git Product home page Git Product logo

Comments (10)

Nasar165 avatar Nasar165 commented on June 27, 2024 2

Solution

For those who get the following error using Apple MacBook: RSV1 set, bad opcode 7, bad Mask when trying to connect from any client within the system can try and disable Content & Privacy that can be found in settings > Screen time > Content & Privacy and then disable Content & Privacy. This solved my issue on my MacBook M1 running Sonoma 14.4.

ps: do disable share across device before disabling to not disable on other devices and then restart the laptop and web filter service should be gone.

Command to view services

sudo lsof -i -P | grep LISTEN

Possible reason

Possible reason is that the WebFilter service was filtering the payload modifying the Frame leading to malformed frames unaware if this is intentional of a bug from apple.

from websocket.

jiangbo202 avatar jiangbo202 commented on June 27, 2024 1

Thank you @Nasar165 , using your method also solved my problem

from websocket.

canselcik avatar canselcik commented on June 27, 2024

Similarly on occasion I am getting:

RSV1 set, RSV2 set, bad opcode 15

panic: runtime error: slice bounds out of range [:4643] with capacity 4096
goroutine 645701 [running]:
 bufio.(*Reader).Read(0xc021bbe0c0, {0xc018005ab4?, 0x4c?, 0x1500?})
         /root/go/src/bufio/bufio.go:257 +0x2d0
 github.com/gorilla/websocket.(*messageReader).Read(0xc000186d50, {0xc018005ab4, 0x4c, 0x4c})
        /root/serversrc/server/vendor/github.com/gorilla/websocket/conn.go:1075 +0x1c5
 io.ReadAll({0x7f3f11630f20, 0xc000186d50})
         /root/go/src/io/io.go:704 +0x7e
 github.com/gorilla/websocket.(*Conn).ReadMessage(0x7f3f71fd9a68?)
/root/serversrc/server/vendor/github.com/gorilla/websocket/conn.go:1124 +0x3b

from websocket.

canselcik avatar canselcik commented on June 27, 2024

Similar error, happened today.
RSV2 set, RSV3 set, FIN not set on control

panic: runtime error: slice bounds out of range [:5472] with capacity 4096
goroutine 2743107 [running]:
 bufio.(*Reader).Read(0xc021f567e0, {0xc000293a04?, 0x4fc?, 0x1000?})
         /root/go/src/bufio/bufio.go:257 +0x2d0
 github.com/gorilla/websocket.(*messageReader).Read(0xc00013b150, {0xc000293a04, 0x4fc, 0x4fc})
         /root/serversrc/server/vendor/github.com/gorilla/websocket/conn.go:1075 +0x1c5
 io.ReadAll({0x7fa3e8131498, 0xc00013b150})
         /root/go/src/io/io.go:704 +0x7e
 github.com/gorilla/websocket.(*Conn).ReadMessage(0xc0179c70e0?)
         /root/serversrc/server/vendor/github.com/gorilla/websocket/conn.go:1124 +0x3b

from websocket.

canselcik avatar canselcik commented on June 27, 2024

Thank you @GreenMarmot. I am aware of that and both read and writes are guarded with mutexes. I have also ran the application with the go race detector and haven't hit any results pointing in that direction.

But will continue to explore that angle.

from websocket.

Nasar165 avatar Nasar165 commented on June 27, 2024

Hi where any one able to find any solution to the issue I'm getting a similar error on my M1 machine I've tried running in docker, VM (UTM) Ubuntu server (ARM version) without any success, I've also tried to to reset the MAC to factory without any success. This specific issue seems isolated to M1 since the code works without any issue on m2 also tried using on my AMD cpu and no issues.

Failing Environment

MacBook Pro Apple M1 Sonoma 14.4 16GB Ram

  • Go version 1.22.1 (ARM)
  • Go version 1.22.1 (AMD64) (Rosseta)
  • Docker (ARM)
  • Ubuntu 22 server version (ARM) (UTM VM)
  • Chrome 122.0.6261.129 (Official Build) (arm64)
  • Safari 17.4

Successful environment

  • AMD CPU
  • INTEL CPU
  • MacBook Pro Apple M2 Sonoma 14.4 16GB Ram

Error

RSV1 set, bad opcode 7, bad Mask

  • Frametype is set to 7 which crashes in the select loop

Hint

  • if Compression is enabled RSV1 disappears
  • Attempted other Golang packages fashhttp ,ws all crash
  • Python works without any issues
  • no proxies installed
  • able to send message from server to client
  • only crash when client send to server

from websocket.

Nasar165 avatar Nasar165 commented on June 27, 2024

Happy to be of help @jiangbo202

from websocket.

tubzby avatar tubzby commented on June 27, 2024

Got a similar panic, is it concurrent read your case @canselcik ?

 level=error msg="read error: websocket: RSV2 set, RSV3 set, FIN not set on control" file=signal/ws.go line=87 mo
 panic: runtime error: slice bounds out of range [:4200] with capacity 4096
 goroutine 10353098 [running]:
 bufio.(*Reader).Read(0x40015a7740, {0x4000e15fc8?, 
         /usr/local/go/src/bufio/bufio.go:250 +0x334
 github.com/gorilla/websocket.(*messageReader).Read
         /go/pkg/mod/github.com/gorilla/[email protected].
 io.ReadAll({0x7f63384600, 0x4002dfa1e0})
         /usr/local/go/src/io/io.go:701 +0xe4
 io/ioutil.ReadAll(...)
         /usr/local/go/src/io/ioutil/ioutil.go:27
 github.com/gorilla/websocket.(*Conn).ReadMessage
         /go/pkg/mod/github.com/gorilla/[email protected].
 gdcx.com/rtsp2webrtc/signal.(*wsSignal).connectLoop.
         /usr/src/myapp/signal/ws.go:85 +0xc0
 created by gdcx.com/rtsp2webrtc/signal.(*wsSignal).
         /usr/src/myapp/signal/ws.go:81 +0x274
service: Main process exited, code=exited, status=2/
service: Failed with result 'exit-code'.

My logic is quite simple:

for shouldConnect {
    for {
           connect until success
    }

   go func() {
     for {
         // read until error
         // panic here
          ws.ReadMessage()
          send to channel
     }
   }()

  // read from channel
  // or wait a specific amount of time, send `KeepAlive` to peer.
  for {
  }
}

In my case, read/write might be concurrent, but there's only one reader for a connection.

from websocket.

canselcik avatar canselcik commented on June 27, 2024

Yes, @tubzby, it was. @GreenMarmot was spot on.

In your case I believe if you changed your code to do something to the spirit of the following, the issue will be addressed:

go func(ws *websocket.Conn) {
     for {
         // read until error
         // panic here
          ws.ReadMessage()
          send to channel
     }
   }(ws)

Instead of having your goroutine capture ws from its scope, pass it a parameter.

from websocket.

tubzby avatar tubzby commented on June 27, 2024

@canselcik Thanks for your suggestion, will try that, I'm convinced this was the root cause.

from websocket.

Related Issues (20)

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.