Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable listener raw protocol and cleanup #407

Merged
merged 27 commits into from
Sep 9, 2023
Merged

Conversation

cgalibern
Copy link
Contributor

  • remove code for raw protocol and multiplex
  • refactor requester/jsonrpc to core/omcrypto
  • fix hbucast deadlock

Unexpected connections are dropped and warn log message is emmited:
  - drop msg from unexpected connection from %

This commit also rephrases log warn messages:
  - unexpected error while closing connection from <remote addr>
  - read failed from <remote addr>
  - read huge message from node <nodename>:<remote addr> msg size: <size>
  - unmarshal message failed from node <nodename>:<remote addr>
…re now aliases

listener raw protocol will be removed, so listener.tls_... is not anymore required.
- listener.tls_addr is now an alias of listener.addr
- listener.tls_port is now an alias of listener.port
ReadWithNode now uses getMessage instead of GetMessages

Bug fixed:
   a cluster with multiple heartbeat but  type (unicast)
   a heartbeat message that contains multiple Scanned results,
        will not give back buffer to msgBufferChan (with size 2)
        => if we receive 2 times such messages then the next ReadWithNode will hang

   Example if msgBufferChan size is 1:
      hbucast handle -> ReadWithNode                                                 T0, T5
        -> func (t *T) ReadWithNode(b []byte) (n int, nodename string, err error) {
       	    encByteChan := make(chan []byte)
       	    go reqjsonrpc.GetMessages(encByteChan, t.Conn)                           T1, T5+
       	       -> func GetMessages(q chan []byte, rc io.ReadCloser) error {
                  	scanner := bufio.NewScanner(rc)
                  	b := <-msgBufferChan                                             T2
                  	                                                                 T5++: hang
                  	defer func() { msgBufferChan <- b }()
                  	scanner.Buffer(*b, msgMaxSize)
                  	scanner.Split(splitFunc)
                  	defer rc.Close()
                  	defer close(q)
                  	for {
                  		scanner.Scan()                                               T3
                  		                                                             T4+
                  		b := scanner.Bytes()
                  		if len(b) == 0 {
                  			break
                  		}
                  		q <- append([]byte{}, b...)                                  T4
                  		                                                             T4++ write hang (no more reader since T4+)
                  		                                                                  => defer msgBufferChan <- b not called
                  	}
                  	return scanner.Err()
                  }
            encBytes := <-encByteChan                                                T1+
       	    encMsg := reqjsonrpc.NewMessage(encBytes)                                T4+
… secret from initial ccfg

encryptconn & hbmcast don't anymore need ccfg.Get() on each message
ccfg has a more accurate listener port value than daemonenv.HttpPort
…fix discover fetch failure)

If cluster config listener port != daemonenv.HttpPort the discover client use wrong url
and can't fetch config from remotes.
But need review daemoncli stop
@cgalibern cgalibern merged commit afa4487 into opensvc:main Sep 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant