TestCpp v2.2.6 HttpClient Crash on ~CurlRaii with arm64

Hi, I have a crash on TestCpp v2.2.6 and XCode 6.1.1

To reproduce:

  • adding arm64 as valid architectures
  • run on iOS Simulator iPhone 6 with Build configuration = Release
  • click on Extension Test -> HttpClient Test -> Test get

return EXC_BAD_ACCESS on curl_easy_cleanup(m_curl) [HttpClient.cpp row 286]

~CURLRaii()
{
    if (m_curl)
        curl_easy_cleanup(m_curl);
    /* free the linked list for header data */
    if (m_headers)
        curl_slist_free_all(m_headers);
}

STACK:
Cocos2d::extension::CURLRaii::~CurlRaii() - HttpClient.cpp 286
Cocos2d::extension::processDeleteTask(CCHttpRequest requestā€¦ - HttpClient.cpp 389
Cocos2d::extension::networkThread(void
) - HttpClient.cpp 178

NOTE:

  • Build configuration = Debug works well
  • ā€œTest Postā€ works well (also in release)
  • I havenā€™t tried on real device

Someone can reproduce it and help me to resolve?

Thanks
Don

The same thing for me. But only for ā€˜releaseā€™.
Have no idea how to solve that. I donā€™t use HTTP ā€˜deleteā€™. So obviously itā€™s something with access violation

Also for me, only release

Iā€™ve resolved using POST, instead GET

Modify CURLRaii::perform method:
From
bool perform(int *responseCode)
{
if (CURLE_OK != curl_easy_perform(m_curl))
return false;
CURLcode code = curl_easy_getinfo(m_curl, CURLINFO_RESPONSE_CODE, responseCode);
ā€¦
}
TO

bool perform(int *responseCode)
{
if (CURLE_OK != curl_easy_perform(m_curl))
return false;
long tmpCode = 0;
CURLcode code = curl_easy_getinfo(m_curl, CURLINFO_RESPONSE_CODE, &tmpCode);
*responseCode = (int)tmpCode;
ā€¦
}

3 Likes

Has anyone found a solution for this? My game have been rejected several times due to this error on cocos2d-x2.2.6, and I donā€™t know how to solve this issue.

Thread 21 Crashed:
0   Guess                         	0x00000001009b348c Curl_close + 16
1   Guess                         	0x0000000100374310 cocos2d::extension::CURLRaii::~CURLRaii() (HttpClient.cpp:286)
2   Guess                         	0x0000000100374310 cocos2d::extension::CURLRaii::~CURLRaii() (HttpClient.cpp:286)
3   Guess                         	0x0000000100373df4 cocos2d::extension::networkThread(void*) (HttpClient.cpp:284)
4   libsystem_pthread.dylib       	0x00000001963c7dc4 _pthread_body + 160
5   libsystem_pthread.dylib       	0x00000001963c7d20 _pthread_start + 156
6   libsystem_pthread.dylib       	0x00000001963c4ef4 thread_start + 0

After testing the game in ā€œrelease modeā€ with this options

Test your game on xcode in release mode

I test the bhkkbhkk solution, and now it works fine.

Letā€™s build another version and submit to app store. :wink: