[deleted]
↧
New Post: HttpClient SSL A connection with the server could not be established
↧
Created Unassigned: Problems with Visual Studio 2015 [423]
With the final release of Visual Studio 2015 the library downloaded from NuGet package Manager not work.
https://www.nuget.org/packages/cpprestsdk.android/
The final release of Visual Studio 2015 uses clang 3.6.
The latest version of c++ rest sdk is compiled with clang 3.4:
cpprestsdk.android
cpprestsdk.clang-3-4.android-19.libstdcxx.static.rt-static
Is there a way to use these library with clang 3.6?
https://www.nuget.org/packages/cpprestsdk.android/
The final release of Visual Studio 2015 uses clang 3.6.
The latest version of c++ rest sdk is compiled with clang 3.4:
cpprestsdk.android
cpprestsdk.clang-3-4.android-19.libstdcxx.static.rt-static
Is there a way to use these library with clang 3.6?
↧
↧
Edited Unassigned: Problems with Visual Studio 2015 [423]
With the final release of Visual Studio 2015 the library downloaded from NuGet package Manager not works.
https://www.nuget.org/packages/cpprestsdk.android/
The final release of Visual Studio 2015 uses clang 3.6.
The latest version of c++ rest sdk is compiled with clang 3.4:
cpprestsdk.android
cpprestsdk.clang-3-4.android-19.libstdcxx.static.rt-static
Is there a way to use these library with clang 3.6?
https://www.nuget.org/packages/cpprestsdk.android/
The final release of Visual Studio 2015 uses clang 3.6.
The latest version of c++ rest sdk is compiled with clang 3.4:
cpprestsdk.android
cpprestsdk.clang-3-4.android-19.libstdcxx.static.rt-static
Is there a way to use these library with clang 3.6?
↧
Edited Unassigned: Android version, problems with Visual Studio 2015 [423]
With the final release of Visual Studio 2015 the library downloaded from NuGet package Manager not works.
https://www.nuget.org/packages/cpprestsdk.android/
The final release of Visual Studio 2015 uses clang 3.6.
The latest version of c++ rest sdk is compiled with clang 3.4:
cpprestsdk.android
cpprestsdk.clang-3-4.android-19.libstdcxx.static.rt-static
Is there a way to use these library with clang 3.6?
https://www.nuget.org/packages/cpprestsdk.android/
The final release of Visual Studio 2015 uses clang 3.6.
The latest version of c++ rest sdk is compiled with clang 3.4:
cpprestsdk.android
cpprestsdk.clang-3-4.android-19.libstdcxx.static.rt-static
Is there a way to use these library with clang 3.6?
↧
Edited Issue: No cpprestsdk.v140.winxp.msvcstl.dyn.rt-dyn NuGet package available [409]
There is no cpprestsdk.v140.winxp.msvcstl.dyn.rt-dyn NuGet package available for version 2.6.0.
Will future versions support "v140_xp" platform toolset and if they will, when will they be released?
We have upgraded the project to Visual Studio 2015 and we still have to support XP. It is now impossible to continue because there is no NuGet package for this platform toolset.
Will future versions support "v140_xp" platform toolset and if they will, when will they be released?
We have upgraded the project to Visual Studio 2015 and we still have to support XP. It is now impossible to continue because there is no NuGet package for this platform toolset.
↧
↧
Edited Issue: File streams do not support files > 4 GB on Win32 [411]
The stream classes in concurrency::streams do not support files > 4 GB when used from a 32-Bit process. See the following code and attached project.
The output is:
The actual size of the file is 4294967296
The expected size of the file is 5368709120
```
#include "stdafx.h"
#include <cpprest\filestream.h>
#include <cpprest\containerstream.h>
#include <filesystem>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace concurrency::streams;
using namespace std::tr2::sys;
const wchar_t* fileName = L"D:\\Temp\\Data.bin";
auto stream = file_stream<uint8_t>::open_ostream(fileName, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc).get();
const size_t blockSize = 16 * 1024 * 1024;
const size_t blockCount = 320; // 320 * 16 MByte = 5 GByte
std::vector<uint8_t> block(blockSize);
std::wcout << L"Creating 5 GByte file " << fileName << std::endl;
for (size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
{
container_buffer<std::vector<uint8_t>> outBuffer(block);
stream.write(outBuffer, static_cast<size_t>(outBuffer.size())).get();
std::wcout << L".";
}
stream.close().get();
auto fileSize = file_size(wpath(fileName));
std::wcout << L"\nThe actual size of the file is " << fileSize << std::endl;
std::wcout << L"The expected size of the file is " << uint64_t(blockSize) * blockCount << std::endl;
return 0;
}
```
The output is:
The actual size of the file is 4294967296
The expected size of the file is 5368709120
```
#include "stdafx.h"
#include <cpprest\filestream.h>
#include <cpprest\containerstream.h>
#include <filesystem>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace concurrency::streams;
using namespace std::tr2::sys;
const wchar_t* fileName = L"D:\\Temp\\Data.bin";
auto stream = file_stream<uint8_t>::open_ostream(fileName, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc).get();
const size_t blockSize = 16 * 1024 * 1024;
const size_t blockCount = 320; // 320 * 16 MByte = 5 GByte
std::vector<uint8_t> block(blockSize);
std::wcout << L"Creating 5 GByte file " << fileName << std::endl;
for (size_t blockIndex = 0; blockIndex < blockCount; ++blockIndex)
{
container_buffer<std::vector<uint8_t>> outBuffer(block);
stream.write(outBuffer, static_cast<size_t>(outBuffer.size())).get();
std::wcout << L".";
}
stream.close().get();
auto fileSize = file_size(wpath(fileName));
std::wcout << L"\nThe actual size of the file is " << fileSize << std::endl;
std::wcout << L"The expected size of the file is " << uint64_t(blockSize) * blockCount << std::endl;
return 0;
}
```
↧
Edited Issue: Heap corruption when free Winhttp objects [406]
Hi cpprest team,
We are using azure storage SDK which is using cpprest to manage http request. We are seeing a heap corruption crash in our process. Here is the call stack of where the heap corruption is detected. Could you please help take a look? This issue has a big impact on our services.
You can find full dump in share (file://HANG-PC-03/share)
0:029> k
*** Stack trace for last set context - .thread/.cxr resets it
Child-SP RetAddr Call Site
00000000`2082edd0 00007ffe`aac54162 ntdll!RtlReportCriticalFailure+0x8c [d:\9140\minkernel\ntos\rtl\rtlutil.c @ 184]
00000000`2082eee0 00007ffe`aac54d60 ntdll!RtlpHeapHandleError+0x12 [d:\9140\minkernel\ntos\rtl\heaplog.c @ 378]
00000000`2082ef10 00007ffe`aac0b21a ntdll!RtlpLogHeapFailure+0xa4 [d:\9140\minkernel\ntos\rtl\heaplog.c @ 677]
00000000`2082ef40 00007ffe`a27e7d44 ntdll![__RtlFreeHeap__]+0x760ea [d:\9140\minkernel\ntos\rtl\heap.c @ 2101]
00000000`2082efe0 00007ffe`a27e7ed7 __winhttp__!CRequestParameters::~CRequestParameters+0x62
00000000`2082f010 00007ffe`a27f9cf4 winhttp!HTTP_REQUEST_HANDLE_OBJECT::`scalar deleting destructor'+0xe7
00000000`2082f0b0 00007ffe`a27e823e winhttp!HANDLE_OBJECT::Dereference+0x20274 [d:\9147\net\winhttp\handles\hinet.cxx @ 403]
00000000`2082f0f0 00007ffe`a27e8154 winhttp!HTTP_USER_REQUEST::~HTTP_USER_REQUEST+0xbe [d:\9147\net\winhttp\httpcore\usrreq.cpp @ 431]
00000000`2082f140 00007ffe`a27e8124 winhttp!HTTP_USER_REQUEST::`scalar deleting destructor'+0x14
00000000`2082f170 00007ffe`a27e7988 winhttp!HTTP_BASE_OBJECT::Dereference+0x13b [d:\9147\net\winhttp\common\httpbase.cpp @ 91]
00000000`2082f1b0 00007ffe`a27e770d winhttp!HTTP_USER_REQUEST::OnSendRequest+0x203 [d:\9147\net\winhttp\httpcore\usrreq.cpp @ 3063]
00000000`2082f3a0 00007ffe`a27db5ac winhttp!WEBIO_REQUEST::OnIoComplete+0x445 [d:\9147\net\winhttp\httpcore\sysreq.cpp @ 2363]
00000000`2082f470 00007ffe`aab9a497 winhttp!HTTP_THREAD_POOL::_StaticWorkItemCallback+0x17c [d:\9147\net\winhttp\async\thrdpool.cpp @ 621]
00000000`2082f530 00007ffe`aab988b7 ntdll!TppWorkpExecuteCallback+0x2e7 [d:\9140\minkernel\threadpool\ntdll\work.c @ 671]
00000000`2082f5a0 00007ffe`a9fc13d2 ntdll!TppWorkerThread+0x447 [d:\9140\minkernel\threadpool\ntdll\worker.c @ 1075]
00000000`2082f980 00007ffe`aab75444 kernel32!BaseThreadInitThunk+0x22
00000000`2082f9b0 00000000`00000000 ntdll!RtlUserThreadStart+0x34 [d:\9140\minkernel\ntdll\rtlstrt.c @ 1026]
0:029> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
Failed calling InternetOpenUrl, GLE=12029
Debugger WatsonDb Connection::Open failed 80040e4d
*** The OS name list needs to be updated! Unknown Windows version: 6.3 ***
FAULTING_IP:
ntdll!RtlReportCriticalFailure+8c [d:\9140\minkernel\ntos\rtl\rtlutil.c @ 184]
00007ffe`aac50f20 eb00 jmp ntdll!RtlReportCriticalFailure+0x8e (00007ffe`aac50f22)
EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 00007ffeaac50f20 (ntdll!RtlReportCriticalFailure+0x000000000000008c)
ExceptionCode: c0000374
ExceptionFlags: 00000001
NumberParameters: 1
Parameter[0]: 00007ffeaac8dd40
PROCESS_NAME: mysqld.exe
ERROR_CODE: (NTSTATUS) 0xc0000374 - __A heap has been corrupted__.
EXCEPTION_CODE: (NTSTATUS) 0xc0000374 - A heap has been corrupted.
EXCEPTION_PARAMETER1: 00007ffeaac8dd40
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
ADDITIONAL_DEBUG_TEXT: Followup set based on attribute [Heap_Error_Type] from Frame:[0] on thread:[PSEUDO_THREAD] ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]
LAST_CONTROL_TRANSFER: from 00007ffeaac54162 to 00007ffeaac50f20
FAULTING_THREAD: ffffffffffffffff
BUGCHECK_STR: APPLICATION_FAULT_ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_INVALID_POINTER_READ_AFTER_CALL
PRIMARY_PROBLEM_CLASS: ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_AFTER_CALL
DEFAULT_BUCKET_ID: ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_AFTER_CALL
STACK_TEXT:
00000000`00000000 00000000`00000000 winhttp!WEBIO_REQUEST::OnIoComplete+0x0
FOLLOWUP_IP:
winhttp!WEBIO_REQUEST::OnIoComplete+0 [d:\9147\net\winhttp\httpcore\sysreq.cpp @ 2326]
00007ffe`a27e75b0 4c8bdc mov r11,rsp
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: winhttp!WEBIO_REQUEST::OnIoComplete+0
FOLLOWUP_NAME: wintriage
MODULE_NAME: winhttp
IMAGE_NAME: winhttp.dll
DEBUG_FLR_IMAGE_TIMESTAMP: 54503f56
STACK_COMMAND: !heap ; ** Pseudo Context ** ; kb
FAILURE_BUCKET_ID: ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_AFTER_CALL_c0000374_winhttp.dll!WEBIO_REQUEST::OnIoComplete
BUCKET_ID: X64_APPLICATION_FAULT_ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_INVALID_POINTER_READ_AFTER_CALL_winhttp!WEBIO_REQUEST::OnIoComplete+0
WATSON_STAGEONE_URL: http://watson.microsoft.com/StageOne/mysqld_exe/5_5_39_0/53ca16fc/ntdll_dll/6_3_9600_17736/550f4336/c0000374/000f0f20.htm?Retriage=1
Followup: wintriage
Thanks.
We are using azure storage SDK which is using cpprest to manage http request. We are seeing a heap corruption crash in our process. Here is the call stack of where the heap corruption is detected. Could you please help take a look? This issue has a big impact on our services.
You can find full dump in share (file://HANG-PC-03/share)
0:029> k
*** Stack trace for last set context - .thread/.cxr resets it
Child-SP RetAddr Call Site
00000000`2082edd0 00007ffe`aac54162 ntdll!RtlReportCriticalFailure+0x8c [d:\9140\minkernel\ntos\rtl\rtlutil.c @ 184]
00000000`2082eee0 00007ffe`aac54d60 ntdll!RtlpHeapHandleError+0x12 [d:\9140\minkernel\ntos\rtl\heaplog.c @ 378]
00000000`2082ef10 00007ffe`aac0b21a ntdll!RtlpLogHeapFailure+0xa4 [d:\9140\minkernel\ntos\rtl\heaplog.c @ 677]
00000000`2082ef40 00007ffe`a27e7d44 ntdll![__RtlFreeHeap__]+0x760ea [d:\9140\minkernel\ntos\rtl\heap.c @ 2101]
00000000`2082efe0 00007ffe`a27e7ed7 __winhttp__!CRequestParameters::~CRequestParameters+0x62
00000000`2082f010 00007ffe`a27f9cf4 winhttp!HTTP_REQUEST_HANDLE_OBJECT::`scalar deleting destructor'+0xe7
00000000`2082f0b0 00007ffe`a27e823e winhttp!HANDLE_OBJECT::Dereference+0x20274 [d:\9147\net\winhttp\handles\hinet.cxx @ 403]
00000000`2082f0f0 00007ffe`a27e8154 winhttp!HTTP_USER_REQUEST::~HTTP_USER_REQUEST+0xbe [d:\9147\net\winhttp\httpcore\usrreq.cpp @ 431]
00000000`2082f140 00007ffe`a27e8124 winhttp!HTTP_USER_REQUEST::`scalar deleting destructor'+0x14
00000000`2082f170 00007ffe`a27e7988 winhttp!HTTP_BASE_OBJECT::Dereference+0x13b [d:\9147\net\winhttp\common\httpbase.cpp @ 91]
00000000`2082f1b0 00007ffe`a27e770d winhttp!HTTP_USER_REQUEST::OnSendRequest+0x203 [d:\9147\net\winhttp\httpcore\usrreq.cpp @ 3063]
00000000`2082f3a0 00007ffe`a27db5ac winhttp!WEBIO_REQUEST::OnIoComplete+0x445 [d:\9147\net\winhttp\httpcore\sysreq.cpp @ 2363]
00000000`2082f470 00007ffe`aab9a497 winhttp!HTTP_THREAD_POOL::_StaticWorkItemCallback+0x17c [d:\9147\net\winhttp\async\thrdpool.cpp @ 621]
00000000`2082f530 00007ffe`aab988b7 ntdll!TppWorkpExecuteCallback+0x2e7 [d:\9140\minkernel\threadpool\ntdll\work.c @ 671]
00000000`2082f5a0 00007ffe`a9fc13d2 ntdll!TppWorkerThread+0x447 [d:\9140\minkernel\threadpool\ntdll\worker.c @ 1075]
00000000`2082f980 00007ffe`aab75444 kernel32!BaseThreadInitThunk+0x22
00000000`2082f9b0 00000000`00000000 ntdll!RtlUserThreadStart+0x34 [d:\9140\minkernel\ntdll\rtlstrt.c @ 1026]
0:029> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
Failed calling InternetOpenUrl, GLE=12029
Debugger WatsonDb Connection::Open failed 80040e4d
*** The OS name list needs to be updated! Unknown Windows version: 6.3 ***
FAULTING_IP:
ntdll!RtlReportCriticalFailure+8c [d:\9140\minkernel\ntos\rtl\rtlutil.c @ 184]
00007ffe`aac50f20 eb00 jmp ntdll!RtlReportCriticalFailure+0x8e (00007ffe`aac50f22)
EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 00007ffeaac50f20 (ntdll!RtlReportCriticalFailure+0x000000000000008c)
ExceptionCode: c0000374
ExceptionFlags: 00000001
NumberParameters: 1
Parameter[0]: 00007ffeaac8dd40
PROCESS_NAME: mysqld.exe
ERROR_CODE: (NTSTATUS) 0xc0000374 - __A heap has been corrupted__.
EXCEPTION_CODE: (NTSTATUS) 0xc0000374 - A heap has been corrupted.
EXCEPTION_PARAMETER1: 00007ffeaac8dd40
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
ADDITIONAL_DEBUG_TEXT: Followup set based on attribute [Heap_Error_Type] from Frame:[0] on thread:[PSEUDO_THREAD] ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]
LAST_CONTROL_TRANSFER: from 00007ffeaac54162 to 00007ffeaac50f20
FAULTING_THREAD: ffffffffffffffff
BUGCHECK_STR: APPLICATION_FAULT_ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_INVALID_POINTER_READ_AFTER_CALL
PRIMARY_PROBLEM_CLASS: ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_AFTER_CALL
DEFAULT_BUCKET_ID: ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_AFTER_CALL
STACK_TEXT:
00000000`00000000 00000000`00000000 winhttp!WEBIO_REQUEST::OnIoComplete+0x0
FOLLOWUP_IP:
winhttp!WEBIO_REQUEST::OnIoComplete+0 [d:\9147\net\winhttp\httpcore\sysreq.cpp @ 2326]
00007ffe`a27e75b0 4c8bdc mov r11,rsp
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: winhttp!WEBIO_REQUEST::OnIoComplete+0
FOLLOWUP_NAME: wintriage
MODULE_NAME: winhttp
IMAGE_NAME: winhttp.dll
DEBUG_FLR_IMAGE_TIMESTAMP: 54503f56
STACK_COMMAND: !heap ; ** Pseudo Context ** ; kb
FAILURE_BUCKET_ID: ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_AFTER_CALL_c0000374_winhttp.dll!WEBIO_REQUEST::OnIoComplete
BUCKET_ID: X64_APPLICATION_FAULT_ACTIONABLE_HEAP_CORRUPTION_heap_failure_multiple_entries_corruption_INVALID_POINTER_READ_AFTER_CALL_winhttp!WEBIO_REQUEST::OnIoComplete+0
WATSON_STAGEONE_URL: http://watson.microsoft.com/StageOne/mysqld_exe/5_5_39_0/53ca16fc/ntdll_dll/6_3_9600_17736/550f4336/c0000374/000f0f20.htm?Retriage=1
Followup: wintriage
Thanks.
↧
Edited Issue: iOS instructions do not produce a framework [405]
From https://casablanca.codeplex.com/discussions/642168.
> First, I think 'Building Boost' section of 'How to build and setup on iOS' contains errors, as 2nd and 3rd command seem are obsolete.
> Then, when I tried adding boost.framework to Frameworks in Xcode project, Xcode complained that "boost.framework is not a framework". But after I added just boost.a located inside boost.framework, linking succeeded.
> First, I think 'Building Boost' section of 'How to build and setup on iOS' contains errors, as 2nd and 3rd command seem are obsolete.
> Then, when I tried adding boost.framework to Frameworks in Xcode project, Xcode complained that "boost.framework is not a framework". But after I added just boost.a located inside boost.framework, linking succeeded.
↧
Edited Unassigned: Build error on OS X & latest version of clang [404]
Hey,
trying to compile with the latest version of Clang blows up with tons of warnings-turned-to-errors like this:
/.../casablanca/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error:
unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
C_ASSERT( IntTraits<U>::isUint64 );
^
/.../casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note:
expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
There is apparently a new warning in recent versions of clang: http://llvm.org/viewvc/llvm-project?view=revision&revision=217298.
$ clang --version
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
(Building with clang supplied by Xcode 6.4 (based on clang 3.6.0) doesn't produce this error.)
trying to compile with the latest version of Clang blows up with tons of warnings-turned-to-errors like this:
/.../casablanca/Release/include/cpprest/details/SafeInt3.hpp:3144:9: error:
unused typedef '__C_ASSERT__' [-Werror,-Wunused-local-typedef]
C_ASSERT( IntTraits<U>::isUint64 );
^
/.../casablanca/Release/include/cpprest/details/SafeInt3.hpp:153:34: note:
expanded from macro 'C_ASSERT'
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
There is apparently a new warning in recent versions of clang: http://llvm.org/viewvc/llvm-project?view=revision&revision=217298.
$ clang --version
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
(Building with clang supplied by Xcode 6.4 (based on clang 3.6.0) doesn't produce this error.)
↧
↧
Edited Unassigned: Uri encoding API doesn't appear to encode query values correctly [417]
The uri_builder class has set_query and append_query methods that take a string, and a flag to indicate whether encoding is required. The documentation states that the query separator (ampersand) character is taken care of, so we don't need to worry about it.
Problem is, I have a query key/value pair where the key is "realm" and the value is "R&D". I need the encoding API to recognise this, and create the query string of "realm=R%26D", however it encodes it as "realm=R&D".
Problem is, I have a query key/value pair where the key is "realm" and the value is "R&D". I need the encoding API to recognise this, and create the query string of "realm=R%26D", however it encodes it as "realm=R&D".
↧
Edited Unassigned: Update to C++14 standards [415]
With C++14 standards, we can use many cool C++ syntax including the generic lambda, and it is not a big effort to upgrade, only the compiler setting and regression testing. Current code should compile with C++14.
↧
Edited Unassigned: [Documentation] json::object::find [416]
The documentation should read: "If no value is found, returns json::object::end". Or something similar.
↧
Commented Unassigned: [Documentation] json::object::find [416]
The documentation should read: "If no value is found, returns json::object::end". Or something similar.
Comments: Let us fix the documentation.
Comments: Let us fix the documentation.
↧
↧
Edited Issue: http_listener crashes when URI contains a pending square bracket [413]
When a square bracket is present at the last position in the URI, http_listener throws an uri_exception which isn't catched, thus the program is terminated (as of Casablanca 2.5.0). Somehow Http Server API seems to allow a pending "[" or "]" in CookedUrl.pFullUrl on Window 7.
The fix seems to be trivial:
void windows_request_context::read_headers_io_completion(DWORD error_code, DWORD)
{
if(error_code != NO_ERROR)
{
m_msg.reply(status_codes::InternalError);
}
else
{
try // FIX:::
{
// Parse headers.
// CookedUrl.pFullUrl contains the canonicalized URL and it is not encoded
// However, Query strings are opaque to http.sys and are passed as-is => CookedUrl.pFullUrl
// contains an already encoded version of query string.
uri_builder builder(uri::encode_uri(m_request->CookedUrl.pFullUrl));
.....
}
catch (...) // FIX:::
{
// mrkkrj, 08/24/2015
// possible, Http Server API seems to allow a pending "[" or "]" in CookedUrl.pFullUrl!!!
m_msg.reply(status_codes::BadRequest);
}
}
}
The fix seems to be trivial:
void windows_request_context::read_headers_io_completion(DWORD error_code, DWORD)
{
if(error_code != NO_ERROR)
{
m_msg.reply(status_codes::InternalError);
}
else
{
try // FIX:::
{
// Parse headers.
// CookedUrl.pFullUrl contains the canonicalized URL and it is not encoded
// However, Query strings are opaque to http.sys and are passed as-is => CookedUrl.pFullUrl
// contains an already encoded version of query string.
uri_builder builder(uri::encode_uri(m_request->CookedUrl.pFullUrl));
.....
}
catch (...) // FIX:::
{
// mrkkrj, 08/24/2015
// possible, Http Server API seems to allow a pending "[" or "]" in CookedUrl.pFullUrl!!!
m_msg.reply(status_codes::BadRequest);
}
}
}
↧
New Post: building with _UNICODE ?
Hi
-is it possible under windows with visual studio to build casablanca with _UNICODE ? because I want to build my whole project (that uses casablanca) with _UNICODE.
-is it possible under windows with visual studio to build casablanca with _UNICODE ? because I want to build my whole project (that uses casablanca) with _UNICODE.
↧
New Post: building with _UNICODE ?
I believe we use _UNICODE for Casablanca. What behavior are you seeing that suggests otherwise?
↧
New Post: UTF-16 string is missing low surrogate
Hi, we have managed to identify the offending input and it turns out to be a specific Emoji character. We tried Casablanca by building it both with its own UTF16 converter implementation and the one based on the C++ 11 wstring_convert: both cases fail to parse the incoming JSON and in both cases the whole extract_json task fails.
Gergely
Gergely
↧
↧
Commented Unassigned: Crash in tasks when calling http_client.request() on Linux. [420]
I've added Casablanca to an application I'm building that works on Windows and Linux. When I have Casablanca send REST requests to our server on Windows, everything works fine and I don't get any crash. However, on Linux the application runs but crashes anytime I try to send a request with Casablanca and I'm not sure why. It appears to be some kind of memory corruption due to bad strings, but I'm having difficulty figuring out what's going wrong. Note that the exact same code works fine on Windows - the only difference is that Windows uses wide strings and Linux doesn't (due to Casablanca's restriction here).
Here's the code I'm using (all are my files):
RestClient.h
```
private:
/// <summary>
/// The internal client used to send REST requests (Casablanca).
/// </summary>
web::http::client::http_client m_client;
```
RestClient.cpp
```
// Server root URL is a std::string that points to my server.
RestClient::RestClient(const LamaString& serverRootUri)
: m_client(serverRootUri)
{
}
HttpResponse RestClient::Get(const LamaString& url)
{
http_request request = BuildStandardHttpRequest(url, methods::GET);
return Send(request);
}
http_request RestClient::BuildStandardHttpRequest(
const LamaString& url,
const LamaString& method)
{
http_request request(method);
uri_builder builder(url);
request.set_request_uri(builder.to_uri());
request.headers().add(header_names::accept, U("application/json"));
request.headers().add(U(APPLICATION_ID_HTTP_HEADER), U(APPLICATION_ID));
request.headers().add(U(MACHINE_ID_HTTP_HEADER), U(MACHINE_ID));
return request;
}
HttpResponse RestClient::Send(http_request request)
{
// This call is where the memory corruption occurs, it stops program execution here on Linux.
task<http_response> task = m_client.request(request);
return HttpResponse();
}
```
Here's the error I'm getting in Eclipse:
malloc(): memory corruption: 0x0000000001b17c10 ***
Here's the call stack I'm seeing:
```
__GI_raise() at raise.c:56 0x7ffff2b99cc9
__GI_abort() at abort.c:89 0x7ffff2b9d0d8
__libc_message() at libc_fatal.c:175 0x7ffff2bd6394
malloc_printerr() at malloc.c:4,996 0x7ffff2be3f36
_int_malloc() at malloc.c:3,447 0x7ffff2be3f36
__GI___libc_malloc() at malloc.c:2,891 0x7ffff2be57b0
operator new() at 0x7ffff34a2dad
__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_response, std::allocator<web::http::details::_http_response>, (__gnu_cxx::_Lock_policy)2> >::allocate at new_allocator.h:104 0x7ffff4dff162
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_response, std::allocator<web::http::details::_http_response>, (__gnu_cxx::_Lock_policy)2> > >::allocate at alloc_traits.h:351 0x7ffff4dfe518
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<web::http::details::_http_response, std::allocator<web::http::details::_http_response>> at shared_ptr_base.h:499 0x7ffff4dfd5f6
std::__shared_ptr<web::http::details::_http_response, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<web::http::details::_http_response>> at shared_ptr_base.h:957 0x7ffff4dfc4b0
std::shared_ptr<web::http::details::_http_response>::shared_ptr<std::allocator<web::http::details::_http_response>>() at shared_ptr.h:316 0x7ffff4df9a50
std::allocate_shared<web::http::details::_http_response, std::allocator<web::http::details::_http_response>>() at shared_ptr.h:598 0x7ffff4df66f0
std::make_shared<web::http::details::_http_response>() at shared_ptr.h:614 0x7ffff4df2fb1
web::http::http_response::http_response() at http_msg.h:391 0x7ffff4df0da0
pplx::details::_ResultHolder<web::http::http_response>::_ResultHolder() at pplxtasks.h:832 0x7ffff4e03dde
pplx::details::_Task_impl<web::http::http_response>::_Task_impl() at pplxtasks.h:2,412 0x7ffff4fab291
__gnu_cxx::new_allocator<pplx::details::_Task_impl<web::http::http_response> >::construct<pplx::details::_Task_impl<web::http::http_response><pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> >() at new_allocator.h:120 0x7ffff4faac21
std::allocator_traits<std::allocator<pplx::details::_Task_impl<web::http::http_response> > >::_S_construct<pplx::details::_Task_impl<web::http::http_response><pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> >() at alloc_traits.h:254 0x7ffff4fa9db9
std::allocator_traits<std::allocator<pplx::details::_Task_impl<web::http::http_response> > >::construct<pplx::details::_Task_impl<web::http::http_response><pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> >() at alloc_traits.h:393 0x7ffff4fa8d72
std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> at shared_ptr_base.h:399 0x7ffff4fa6916
__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2><std::allocator<pplx::details::_Task_impl<web::http::http_response> > const, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> > at new_allocator.h:120 0x7ffff4fa4d65
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2><std::allocator<pplx::details::_Task_impl<web::http::http_response> > const, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> > at alloc_traits.h:254 0x7ffff4fa2f45
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2><std::allocator<pplx::details::_Task_impl<web::http::http_response> > const, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> > at alloc_traits.h:393 0x7ffff4fa0286
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> at shared_ptr_base.h:502 0x7ffff4f9e335
std::__shared_ptr<pplx::details::_Task_impl<web::http::http_response>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> at shared_ptr_base.h:957 0x7ffff4f9b1db
std::shared_ptr<pplx::details::_Task_impl<web::http::http_response> >::shared_ptr<std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&>() at shared_ptr.h:316 0x7ffff4f9827e
std::allocate_shared<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&>() at shared_ptr.h:598 0x7ffff4f95972
std::make_shared<pplx::details::_Task_impl<web::http::http_response>, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&>() at shared_ptr.h:614 0x7ffff4f9252d
pplx::details::_Task_ptr<web::http::http_response>::_Make() at pplxtasks.h:1,429 0x7ffff4f8e519
pplx::task<web::http::http_response>::_CreateImpl() at pplxtasks.h:3,630 0x7ffff4f89d3f
pplx::task<web::http::http_response>::task<pplx::task_completion_event<web::http::http_response> >() at pplxtasks.h:3,304 0x7ffff4f8e325
pplx::create_task<pplx::task_completion_event<web::http::http_response> >() at pplxtasks.h:4,726 0x7ffff4f89ba0
0x0
```
I also tried to reproduce the error directly by removing all Casablanca code except calling some of the task creation code directly like the library does internally. When I do this, I get another exception when attempting to destroy the _http_response internal structure. Note this snippet of code also works fine on Windows and doesn't crash. In this case I'm not passing strings of any kind to Casablanca and it's still crashing, so I'm not sure why this is.
Here's the small snippet I tried:
```
task_completion_event<http_response> e;
create_task(e);
```
Here's the callstack I get after the task goes out of scope (truncated due to character limit when posting):
Thread #1 [app] 20995 [core: 0] (Suspended : Signal : SIGSEGV:Segmentation fault)
__gnu_cxx::__exchange_and_add() at atomicity.h:49 0xba9942
__gnu_cxx::__exchange_and_add_dispatch() at atomicity.h:82 0xba99d7
std::string::_Rep::_M_dispose() at basic_string.h:246 0xbb21e0
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at
...
Here's what the locals window shows on the string:
_M_p char * 0x1 <error: Cannot access memory at address 0x1>
Any help is appreciated!
Comments: Still trying to dig into this. From what I can tell, it looks like the _http_request structure is not being properly initialized and then is being used later when making a request. Here's the Valgrind dump I'm seeing: ``` ==2745== Conditional jump or move depends on uninitialised value(s) ==2745== at 0x95949F7: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) ==2745== by 0x9594A42: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) ==2745== by 0x9594BE3: __gnu_debug::_Safe_iterator_base::_M_detach() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) ==2745== by 0xB9C401: __gnu_debug::_Safe_iterator_base::~_Safe_iterator_base() (safe_base.h:104) ==2745== by 0x1066AC5: __gnu_debug::_Safe_iterator<std::_Rb_tree_const_iterator<std::pair<std::string const, std::string> >, std::__debug::map<std::string, std::string, web::http::http_headers::_case_insensitive_cmp, std::allocator<std::pair<std::string const, std::string> > > >::~_Safe_iterator() (safe_iterator.h:116) ==2745== by 0x1066B23: web::http::http_headers::has(std::string const&) const (in /home/dirtypiece/Code/Stomperz/LamaSM/src/stepmania) ==2745== by 0x7FBD4A8: web::http::client::http_client::request(web::http::http_request, pplx::cancellation_token const&) (http_client_msg.cpp:122) ==2745== by 0x106720D: web::http::client::http_client::request(std::string const&, pplx::cancellation_token const&) (http_client.h:409) ==2745== by 0x1062080: RestClient::Get(std::string const&) (RestClient.cpp:31) ==2745== by 0xF90301: AnalyticsManager::SynchronizeClientAndServerTimes() (AnalyticsManager.cpp:86) ==2745== by 0xF901CE: AnalyticsManager::Initialize() (AnalyticsManager.cpp:67) ==2745== by 0xF9006B: AnalyticsManager::AnalyticsManager() (AnalyticsManager.cpp:39) ==2745== Uninitialised value was created by a heap allocation ==2745== at 0x4C2B145: operator new(unsigned long) (vg_replace_malloc.c:333) ==2745== by 0x1074E06: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (new_allocator.h:104) ==2745== by 0x10741F7: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (alloc_traits.h:351) ==2745== by 0x10731B5: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, std::string>(std::_Sp_make_shared_tag, web::http::details::_http_request*, std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr_base.h:499) ==2745== by 0x1071DBF: std::__shared_ptr<web::http::details::_http_request, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<web::http::details::_http_request>, std::string>(std::_Sp_make_shared_tag, std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr_base.h:957) ==2745== by 0x106F5DF: std::shared_ptr<web::http::details::_http_request>::shared_ptr<std::allocator<web::http::details::_http_request>, std::string>(std::_Sp_make_shared_tag, std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr.h:316) ==2745== by 0x106C69F: std::shared_ptr<web::http::details::_http_request> std::allocate_shared<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, std::string>(std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr.h:598) ==2745== by 0x10695AE: std::shared_ptr<web::http::details::_http_request> std::make_shared<web::http::details::_http_request, std::string>(std::string&&) (shared_ptr.h:614) ==2745== by 0x1066EBF: web::http::http_request::http_request(std::string) (http_msg.h:785) ==2745== by 0x10671D6: web::http::client::http_client::request(std::string const&, pplx::cancellation_token const&) (http_client.h:408) ==2745== by 0x1062080: RestClient::Get(std::string const&) (RestClient.cpp:31) ==2745== by 0xF90301: AnalyticsManager::SynchronizeClientAndServerTimes() (AnalyticsManager.cpp:86) ``` Notice the lines that say "Conditional jump or move depends on uninitialised value(s)" and "Uninitialised value was created by a heap allocation". This appears to be where the bad initialization is used but I can't tell for sure. Is anyone else seeing this issue?
Here's the code I'm using (all are my files):
RestClient.h
```
private:
/// <summary>
/// The internal client used to send REST requests (Casablanca).
/// </summary>
web::http::client::http_client m_client;
```
RestClient.cpp
```
// Server root URL is a std::string that points to my server.
RestClient::RestClient(const LamaString& serverRootUri)
: m_client(serverRootUri)
{
}
HttpResponse RestClient::Get(const LamaString& url)
{
http_request request = BuildStandardHttpRequest(url, methods::GET);
return Send(request);
}
http_request RestClient::BuildStandardHttpRequest(
const LamaString& url,
const LamaString& method)
{
http_request request(method);
uri_builder builder(url);
request.set_request_uri(builder.to_uri());
request.headers().add(header_names::accept, U("application/json"));
request.headers().add(U(APPLICATION_ID_HTTP_HEADER), U(APPLICATION_ID));
request.headers().add(U(MACHINE_ID_HTTP_HEADER), U(MACHINE_ID));
return request;
}
HttpResponse RestClient::Send(http_request request)
{
// This call is where the memory corruption occurs, it stops program execution here on Linux.
task<http_response> task = m_client.request(request);
return HttpResponse();
}
```
Here's the error I'm getting in Eclipse:
malloc(): memory corruption: 0x0000000001b17c10 ***
Here's the call stack I'm seeing:
```
__GI_raise() at raise.c:56 0x7ffff2b99cc9
__GI_abort() at abort.c:89 0x7ffff2b9d0d8
__libc_message() at libc_fatal.c:175 0x7ffff2bd6394
malloc_printerr() at malloc.c:4,996 0x7ffff2be3f36
_int_malloc() at malloc.c:3,447 0x7ffff2be3f36
__GI___libc_malloc() at malloc.c:2,891 0x7ffff2be57b0
operator new() at 0x7ffff34a2dad
__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_response, std::allocator<web::http::details::_http_response>, (__gnu_cxx::_Lock_policy)2> >::allocate at new_allocator.h:104 0x7ffff4dff162
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_response, std::allocator<web::http::details::_http_response>, (__gnu_cxx::_Lock_policy)2> > >::allocate at alloc_traits.h:351 0x7ffff4dfe518
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<web::http::details::_http_response, std::allocator<web::http::details::_http_response>> at shared_ptr_base.h:499 0x7ffff4dfd5f6
std::__shared_ptr<web::http::details::_http_response, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<web::http::details::_http_response>> at shared_ptr_base.h:957 0x7ffff4dfc4b0
std::shared_ptr<web::http::details::_http_response>::shared_ptr<std::allocator<web::http::details::_http_response>>() at shared_ptr.h:316 0x7ffff4df9a50
std::allocate_shared<web::http::details::_http_response, std::allocator<web::http::details::_http_response>>() at shared_ptr.h:598 0x7ffff4df66f0
std::make_shared<web::http::details::_http_response>() at shared_ptr.h:614 0x7ffff4df2fb1
web::http::http_response::http_response() at http_msg.h:391 0x7ffff4df0da0
pplx::details::_ResultHolder<web::http::http_response>::_ResultHolder() at pplxtasks.h:832 0x7ffff4e03dde
pplx::details::_Task_impl<web::http::http_response>::_Task_impl() at pplxtasks.h:2,412 0x7ffff4fab291
__gnu_cxx::new_allocator<pplx::details::_Task_impl<web::http::http_response> >::construct<pplx::details::_Task_impl<web::http::http_response><pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> >() at new_allocator.h:120 0x7ffff4faac21
std::allocator_traits<std::allocator<pplx::details::_Task_impl<web::http::http_response> > >::_S_construct<pplx::details::_Task_impl<web::http::http_response><pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> >() at alloc_traits.h:254 0x7ffff4fa9db9
std::allocator_traits<std::allocator<pplx::details::_Task_impl<web::http::http_response> > >::construct<pplx::details::_Task_impl<web::http::http_response><pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> >() at alloc_traits.h:393 0x7ffff4fa8d72
std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> at shared_ptr_base.h:399 0x7ffff4fa6916
__gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2><std::allocator<pplx::details::_Task_impl<web::http::http_response> > const, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> > at new_allocator.h:120 0x7ffff4fa4d65
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2><std::allocator<pplx::details::_Task_impl<web::http::http_response> > const, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> > at alloc_traits.h:254 0x7ffff4fa2f45
std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, (__gnu_cxx::_Lock_policy)2><std::allocator<pplx::details::_Task_impl<web::http::http_response> > const, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> > at alloc_traits.h:393 0x7ffff4fa0286
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> at shared_ptr_base.h:502 0x7ffff4f9e335
std::__shared_ptr<pplx::details::_Task_impl<web::http::http_response>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&> at shared_ptr_base.h:957 0x7ffff4f9b1db
std::shared_ptr<pplx::details::_Task_impl<web::http::http_response> >::shared_ptr<std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&>() at shared_ptr.h:316 0x7ffff4f9827e
std::allocate_shared<pplx::details::_Task_impl<web::http::http_response>, std::allocator<pplx::details::_Task_impl<web::http::http_response> >, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&>() at shared_ptr.h:598 0x7ffff4f95972
std::make_shared<pplx::details::_Task_impl<web::http::http_response>, pplx::details::_CancellationTokenState*&, pplx::scheduler_ptr&>() at shared_ptr.h:614 0x7ffff4f9252d
pplx::details::_Task_ptr<web::http::http_response>::_Make() at pplxtasks.h:1,429 0x7ffff4f8e519
pplx::task<web::http::http_response>::_CreateImpl() at pplxtasks.h:3,630 0x7ffff4f89d3f
pplx::task<web::http::http_response>::task<pplx::task_completion_event<web::http::http_response> >() at pplxtasks.h:3,304 0x7ffff4f8e325
pplx::create_task<pplx::task_completion_event<web::http::http_response> >() at pplxtasks.h:4,726 0x7ffff4f89ba0
0x0
```
I also tried to reproduce the error directly by removing all Casablanca code except calling some of the task creation code directly like the library does internally. When I do this, I get another exception when attempting to destroy the _http_response internal structure. Note this snippet of code also works fine on Windows and doesn't crash. In this case I'm not passing strings of any kind to Casablanca and it's still crashing, so I'm not sure why this is.
Here's the small snippet I tried:
```
task_completion_event<http_response> e;
create_task(e);
```
Here's the callstack I get after the task goes out of scope (truncated due to character limit when posting):
Thread #1 [app] 20995 [core: 0] (Suspended : Signal : SIGSEGV:Segmentation fault)
__gnu_cxx::__exchange_and_add() at atomicity.h:49 0xba9942
__gnu_cxx::__exchange_and_add_dispatch() at atomicity.h:82 0xba99d7
std::string::_Rep::_M_dispose() at basic_string.h:246 0xbb21e0
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() at
...
Here's what the locals window shows on the string:
_M_p char * 0x1 <error: Cannot access memory at address 0x1>
Any help is appreciated!
Comments: Still trying to dig into this. From what I can tell, it looks like the _http_request structure is not being properly initialized and then is being used later when making a request. Here's the Valgrind dump I'm seeing: ``` ==2745== Conditional jump or move depends on uninitialised value(s) ==2745== at 0x95949F7: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) ==2745== by 0x9594A42: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) ==2745== by 0x9594BE3: __gnu_debug::_Safe_iterator_base::_M_detach() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) ==2745== by 0xB9C401: __gnu_debug::_Safe_iterator_base::~_Safe_iterator_base() (safe_base.h:104) ==2745== by 0x1066AC5: __gnu_debug::_Safe_iterator<std::_Rb_tree_const_iterator<std::pair<std::string const, std::string> >, std::__debug::map<std::string, std::string, web::http::http_headers::_case_insensitive_cmp, std::allocator<std::pair<std::string const, std::string> > > >::~_Safe_iterator() (safe_iterator.h:116) ==2745== by 0x1066B23: web::http::http_headers::has(std::string const&) const (in /home/dirtypiece/Code/Stomperz/LamaSM/src/stepmania) ==2745== by 0x7FBD4A8: web::http::client::http_client::request(web::http::http_request, pplx::cancellation_token const&) (http_client_msg.cpp:122) ==2745== by 0x106720D: web::http::client::http_client::request(std::string const&, pplx::cancellation_token const&) (http_client.h:409) ==2745== by 0x1062080: RestClient::Get(std::string const&) (RestClient.cpp:31) ==2745== by 0xF90301: AnalyticsManager::SynchronizeClientAndServerTimes() (AnalyticsManager.cpp:86) ==2745== by 0xF901CE: AnalyticsManager::Initialize() (AnalyticsManager.cpp:67) ==2745== by 0xF9006B: AnalyticsManager::AnalyticsManager() (AnalyticsManager.cpp:39) ==2745== Uninitialised value was created by a heap allocation ==2745== at 0x4C2B145: operator new(unsigned long) (vg_replace_malloc.c:333) ==2745== by 0x1074E06: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (new_allocator.h:104) ==2745== by 0x10741F7: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (alloc_traits.h:351) ==2745== by 0x10731B5: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, std::string>(std::_Sp_make_shared_tag, web::http::details::_http_request*, std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr_base.h:499) ==2745== by 0x1071DBF: std::__shared_ptr<web::http::details::_http_request, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<web::http::details::_http_request>, std::string>(std::_Sp_make_shared_tag, std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr_base.h:957) ==2745== by 0x106F5DF: std::shared_ptr<web::http::details::_http_request>::shared_ptr<std::allocator<web::http::details::_http_request>, std::string>(std::_Sp_make_shared_tag, std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr.h:316) ==2745== by 0x106C69F: std::shared_ptr<web::http::details::_http_request> std::allocate_shared<web::http::details::_http_request, std::allocator<web::http::details::_http_request>, std::string>(std::allocator<web::http::details::_http_request> const&, std::string&&) (shared_ptr.h:598) ==2745== by 0x10695AE: std::shared_ptr<web::http::details::_http_request> std::make_shared<web::http::details::_http_request, std::string>(std::string&&) (shared_ptr.h:614) ==2745== by 0x1066EBF: web::http::http_request::http_request(std::string) (http_msg.h:785) ==2745== by 0x10671D6: web::http::client::http_client::request(std::string const&, pplx::cancellation_token const&) (http_client.h:408) ==2745== by 0x1062080: RestClient::Get(std::string const&) (RestClient.cpp:31) ==2745== by 0xF90301: AnalyticsManager::SynchronizeClientAndServerTimes() (AnalyticsManager.cpp:86) ``` Notice the lines that say "Conditional jump or move depends on uninitialised value(s)" and "Uninitialised value was created by a heap allocation". This appears to be where the bad initialization is used but I can't tell for sure. Is anyone else seeing this issue?
↧
Reviewed: C++ REST SDK 2.6.0 (ott 03, 2015)
Rated 1 Stars (out of 5) - NuGet package of Android version of library not works with Visual Studio 2015
The package only includes binaries for clang 3.4 and not for clang 3.6 that is used by Visual Studio 2015.
↧
New Post: NuGet package for Visual Studio 2015 not works
The NuGet package of Android version of C++ REST SDK not works.
The package contains binaries only for clang 3.4 and not for clang 3.6 that is used by Visual Studio 2015.
Is there a way to use the SDK with Visual Studio 2015?
The package contains binaries only for clang 3.4 and not for clang 3.6 that is used by Visual Studio 2015.
Is there a way to use the SDK with Visual Studio 2015?
↧