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

HTTP SSL Crashing after every 3rd request #2953

Open
shivank1111 opened this issue Nov 19, 2024 · 3 comments
Open

HTTP SSL Crashing after every 3rd request #2953

shivank1111 opened this issue Nov 19, 2024 · 3 comments

Comments

@shivank1111
Copy link

shivank1111 commented Nov 19, 2024

Boost-Version = 1.83

I am using advanced-server-flex example(https://github.com/boostorg/beast/blob/develop/example/advanced/server-flex/advanced_server_flex.cpp) and in that only I have added my changes but the issue is that I am facing crash whenever I am using SSL server but it is fine when I am using plain connection(without ssl).

It is going to the below function and giving this output:

terminate called after throwing an instance of 'boost::wrapexceptboost::asio::execution::bad_executor'
what(): bad executor
make: *** [Makefile:26: run] Aborted (core dumped)

It is coming inside the if(! response_queue_.empty()) condition and after every 3rd request it is giving the bad_executor error.

Kindly help me with the same.

NOTE: I have made some changes in the constructor parameters but I believe that won't have create a issue. Do let me know if any extra information is required.

The below function is same as advanced_server_flex example:

void do_write()
    {
        try
		{
			std::cout<<"http_session do_write"<<"\n";
			if(! response_queue_.empty())
			{
				std::cout<<"TEST CRASH 1.0.1"<<"\n";
				bool keep_alive = response_queue_.front().keep_alive();
				std::cout<<"keep alive value:"<<keep_alive<<"\n";
				//Below line is crashing
				beast::async_write( derived().stream(), std::move(response_queue_.front()), 
					beast::bind_front_handler( &http_session::on_write,	derived().shared_from_this(), keep_alive));
				std::cout<<"TEST CRASH 1.0.2"<<"\n";
			}
		}
		catch (const std::exception& e) 
		{
			log_error("Exception in http_session:: do_write: %s", e.what());
		}
    }
@ashtum
Copy link
Collaborator

ashtum commented Nov 20, 2024

I can't reproduce this. Could you please test if you can reproduce it using the original code in the example?

@shivank1111
Copy link
Author

I tried in the original code, it is not crashing but in my code it is crashing.
I am trying to add one by one my changes in the code, and check where exactly the issue is there. Give me 1-2 days and if required I will ask for help. Till then please don't close this issue.

Thanks for the help!

@vinniefalco
Copy link
Member

An obvious solution presents itself, skip every 3rd request.

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

No branches or pull requests

3 participants