Closed sparktend closed 2 years ago
@sparktend i have similar error but on use HttpServer in post #2498
Let me figure out. But it will take some time!
Hmm, maybe it is the same issue like #2513 ... but this is only a assumption from me. I will verify this.
This issue is stale because it has been open for 365 days with no activity.
This issue was closed because it has been inactive for 60 days since being marked as stale.
Poco::Net::initializeSSL(); Poco::SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new KeyConsoleHandler(true); Poco::SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler(true); Context::Ptr ptrContext = new Context(Context::CLIENT_USE, "", "", "", Context::VERIFY_NONE, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH")); SSLManager::instance().initializeClient(pConsoleHandler, ptrCert, ptrContext); HTTPSClientSession session(uri.getHost(), uri.getPort(), ptrContext); ...
Expected behavior
Send a HTTPS request.
Actual behavior
It will block on
SSLManager::instance().initializeClient(pConsoleHandler, ptrCert, ptrContext);
.only Android. I tried the same code on windows 7 or Linux. It's OK.Steps to reproduce the problem
(please make this a SSCCE, if applicable and reasonable) The code in native C, invoking from JAVA. I tried it from main thread or
new Runnable
. both failed.I debug the code. the flow: initializeClient(..) => assign ptrContext =>
AutoPtr.h template <class Other> AutoPtr(const AutoPtr<Other>& ptr): _ptr(const_cast<Other*>(ptr.get())) { if (_ptr) _ptr->duplicate(); }
=>AtomicCounter.h inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix { ValueType result; { FastMutex::ScopedLock lock(_counter.mutex); result = ++_counter.value; } return result; }
=>ScopedLock.h explicit ScopedLock(M& mutex): _mutex(mutex) { _mutex.lock(); }
=>Mutex.h inline void FastMutex::lock() { lockImpl(); }
=>Mutex_POSIX.h inline void MutexImpl::lockImpl() { if (pthread_mutex_lock(&_mutex)) throw SystemException("cannot lock mutex"); }
It block on pthread_mutex_lock at last. But I don't know why. I tried the code below:Context::Ptr ptrContext(new Context(Context::CLIENT_USE, "", "", "", Context::VERIFY_NONE, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH")); Context::Ptr ptrContext2 = ptrContext; //here
also block. I tried the code below:int testAutoPtr() { RCO* pNew = new RCO; AutoPtr<RCO> p1(pNew); AutoPtr<RCO> p2(p1); AutoPtr<RCO> p3(pNew, true); p2 = 0; p3 = 0; RCO* pRCO = p1; p1 = 0; p1 = new RCO;// _rc == 1 return 0; }
not block.POCO version
1.9.0
Compiler and version
arm-linux-androideabi(ndk-r16b) on ubuntu14.04. static library. Android studio 3.0.1 & cmake.
Operating system and version
Android 6.0 or Android 7.0
Other relevant information
I set POCO_ANDROID macro already.
add_definitions(-DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY)