Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6561817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:38:02+00:00 2026-05-25T13:38:02+00:00

I’m currently stress testing my server. sometimes I get A non-recoverable error occurred during

  • 0

I’m currently stress testing my server.

sometimes I get “A non-recoverable error occurred during database lookup” Error
coming from error.message()

error is sent to my handling function by boost::asio::placeholders::error called on the async_read method.

I have no idea what this error means, and I am not able to reproduce purposely this error, it only happen sometimes and seems to be random (of course it is not, but it seems)

Does anyone have ever got this error message, and if so, know where it came from ?


EDIT 1

Here’s what I found on the boost library, the error is :

no_recovery = BOOST_ASIO_NETDB_ERROR(NO_RECOVERY)

But can’t figure out what this is…


EDIT 2

Just so you know everything about my problem, here the design :

I have only one io_service.
Everytime a user is connecting, an async_read is starting, waiting for something to read.
When it reads something, most of the time, it is doing some work on a thread (coming from a pool), and write something synchronously back to the user. (using boost write).
Even since boost 1.37 claims that synchronous write is thread safe, I’m really worried about the fact that it is coming from this.

If the user sends different message really quick, it can happen that async_read and write are called simultaneously, can it does any harm ?


EDIT 3

Here’s some portion of my code asked by Dave S :

    void TCPConnection::listenForCMD() {
    boost::asio::async_read(m_socket,
                            boost::asio::buffer(m_inbound_data, 3),
                            boost::asio::transfer_at_least(3),
                            boost::bind(&TCPConnection::handle_cmd,
                                        shared_from_this(),
                                        boost::asio::placeholders::error)
                            );
  }

      void TCPConnection::handle_cmd(const boost::system::error_code& error) {
        if (error) {
          std::cout << "ERROR READING : " << error.message() << std::endl;
    return;
        }                                                                                                                                                                                                                              
          std::string str1(m_inbound_data);
          std::string str = str1.substr(0,3);

          std::cout << "COMMAND FUNCTION: " << str << std::endl;

          a_fact func = CommandFactory::getInstance()->getFunction(str);

          if (func == NULL) {
            std::cout << "command doesn't exist: " << str << std::endl;
            return;
          }

          protocol::in::Command::pointer cmd = func(m_socket, client);

          cmd->setCallback(boost::bind(&TCPConnection::command_is_done,
                                       shared_from_this()));
          cmd->parse();                                                                                                                                                                                                                                   
      }

m_inbound_data is a char[3]

Once cmd->parse() is done, it will call a callback command_is_done

  void TCPConnection::command_is_done() {                                                                                                                                                                                                                   
    m_inbound_data[0] = '0';
    m_inbound_data[1] = '0';
    m_inbound_data[2] = '0';

    listenForCMD();
  }

The error occurs in the handle_cmd when checking for error at the first line.

As I said before, the cmd->parse() will parse the command it just got, sometime lauching blocking code in a thread coming from a pool. On this thread it sends back data to the client with a synchronous write.

IMPORTANT THING : The callback command_is_done will always be called before the said thread is launched. this means that listenForCMD is already called when the thread may send something back to the client in synchronous write. Therefore my first worries.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:38:03+00:00Added an answer on May 25, 2026 at 1:38 pm

    When it reads something, most of the time, it is doing some work on a
    thread (coming from a pool), and write something synchronously back to
    the user. (using boost write). Even since boost 1.37 claims that
    synchronous write is thread safe
    , I’m really worried about the fact
    that it is coming from this.

    Emphasis added by me, this is incorrect. A single boost::asio::tcp::socket is not thread safe, the documentation is very clear

    Thread Safety

    Distinct objects: Safe.

    Shared objects: Unsafe.

    It is also very odd to mix async_read() with a blocking write().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.