Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
NetMQ Unhandled Exception Best Practices

I'm using NetMQ for client/server comms for a pricing system using Pub/Sub for price data and Req/Res for C&C. It's working very well except that I'm seeing random and unreproducible exceptions occurring in the bowels of the NetMQ library.

I'm currently using NetMQ v4.0.1.6 on a .Net v4.7.2 stack on Windows Server 2008R2/20012R2.

The exceptions include:

  • NetMQ.FaultException @ NetMQ.Msg.Close()
  • System.ArgumentOutOfRangeException @ NetMQ.Core.Patterns.Utils.ArrayExtensions.Swap[]
  • System.IndexOutOfRangeException @ NetMQ.Core.Utils.YQueue`1[]/NetMQ.Core.Patterns.Utils.Trie.Check()
  • System.Net.Sockets.SocketException @ NetMQ.Core.Mailbox.TryRecv()/NetMQ.Core.Mailbox.Send()
  • System.NullReferenceException @ NetMQ.Core.Patterns.Utils.Trie.ApplyHelper()/NetMQ.Core.Patterns.Utils.Trie.Check()
  • System.ObjectDisposedException @ NetMQ.Core.SocketBase.CheckDisposed()

and are all happening within either the NetMQ.NetMQPoller.RunPoller() or NetMQ.Core.Utils.Proactor.Loop() and I'm at a loss as to how to catch and mitigate them.

What is the correct approach to harden a service/app using NetMQ to prevent such exceptions bringing down the service?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I did this professionally, and with great success, at one large organisation.

The best practice is to include within your loop a try catch handler, and then do something like follows

(Example error types plucked from your list at random)

/*loop*/(/*loop condition*/) {
  try {
    // processing
  } 
  catch (NetMQ.FaultException $exception) {
    // specific error handling
  } 
  catch (System.ObjectDisposedException $exception) {
    // specific error handling
  }
  catch (Exception $exception) {
    // generic error handling
  }
}

Also, feel free to pass it a specific error handling class/service to offload your error handling functionality into a separate location (greater testability).

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda