http_listener.open() simply hangs if I pplx::create_task() {Sleep(forewer);} before hand.
If I first start listener and then launch the task, then all incoming http requests will hang.
This repros 100% on Windows 2012 R2 in Azure (Azure provided image), however it it doesn't repro on Win8.1 non-virtual machine. Win 8.1 non-virtual works just fine, but server hangs.
I use cpprest120d_2_2.dll
Code:
try
{
pplx::create_task([]
{
Sleep(1000000);
});
std::wcout << L"Launching" << std::endl;
listener
.open()
.then([&listener](){std::wcout << L"Start to listen"<<std::endl ; })
.wait();
while (true){ Sleep(1000); }
}
catch (exception const & e)
{
wcout << e.what() << endl;
}
otuput:
httpsample.exe localhost --c
url: http://localhost:9575/restdemo
Launching
// hangs right here
Comments: Tried again with workaround from 106. Apparently the same issue, but on dual core machine. I am not sure why the workaround didn't work for me before. I did try it. So the workaround concurrency::CurrentScheduler::Create(Concurrency::SchedulerPolicy(1, 2, Concurrency::MinConcurrency)); works for me now. Thanks, Ruslan
If I first start listener and then launch the task, then all incoming http requests will hang.
This repros 100% on Windows 2012 R2 in Azure (Azure provided image), however it it doesn't repro on Win8.1 non-virtual machine. Win 8.1 non-virtual works just fine, but server hangs.
I use cpprest120d_2_2.dll
Code:
try
{
pplx::create_task([]
{
Sleep(1000000);
});
std::wcout << L"Launching" << std::endl;
listener
.open()
.then([&listener](){std::wcout << L"Start to listen"<<std::endl ; })
.wait();
while (true){ Sleep(1000); }
}
catch (exception const & e)
{
wcout << e.what() << endl;
}
otuput:
httpsample.exe localhost --c
url: http://localhost:9575/restdemo
Launching
// hangs right here
Comments: Tried again with workaround from 106. Apparently the same issue, but on dual core machine. I am not sure why the workaround didn't work for me before. I did try it. So the workaround concurrency::CurrentScheduler::Create(Concurrency::SchedulerPolicy(1, 2, Concurrency::MinConcurrency)); works for me now. Thanks, Ruslan