Skip to content

Method amqp.Connection.Channel() is blocked for infinity while there is no Internet #225

@dr-begemot

Description

@dr-begemot

Describe the bug

Method amqp.Connection.Channel() is infinity blocked when internet turned off in the middle of DialConfig() and Channel():

	config := amqp.Config{Properties: amqp.NewConnectionProperties()}
	config.Properties.SetClientConnectionName(connName)
	config.Heartbeat = 10 * time.Second
	log.Debug().Msgf("dialing %q", amqpURI)
	conn, err := amqp.DialConfig(amqpURI, config)
	if err != nil {
		return nil, fmt.Errorf("Dial: %s", err)
	}

        // turn off internet here
        log.Debug().Msgf("turn off Internet!")
	time.Sleep(10 * time.Second)

	log.Debug().Msgf("got Connection")
	channel, err := conn.Channel() // infinity blocked while no internet
	if err != nil {
		return nil, fmt.Errorf("Channel: %s", err)
	}

Reproduction steps

  1. Dial to rabbitmq server and get Connection
  2. Turn off internet
  3. Call Connection.Channel() method

Expected behavior

Channel() method should return error after timeout.

Additional context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions