apache / incubator-weex

Apache Weex (Incubating)
https://weex.apache.org
Apache License 2.0
13.75k stars 1.82k forks source link

[Android]Android 11 Not working properly #3255

Open st-dc opened 4 years ago

st-dc commented 4 years ago

The test found that Android 11 mobile phone can't run weex normally

freddyzhu commented 3 years ago

i have the same problem with android 11 mobile phone. Error Log is here: 2020-09-16 20:17:04.304 8213-8401/com.fusionbank.vb E/WeexCore: weex_js_connection.cpp:252,startupPie :1 2020-09-16 20:17:37.300 8213-8401/com.fusionbank.vb E/WeexCore: weex_js_connection.cpp:288,WeexJSConnection catch: spinWaitPeer timeout 2020-09-16 20:17:37.300 8213-8908/com.fusionbank.vb E/WeexCore: weex_js_connection.cpp:183,IPCException server died spinWaitPeer timeout 2020-09-16 20:17:37.300 8213-8401/com.fusionbank.vb E/WeexCore: multi_process_and_so_initializer.cpp:47,JSFramwork init start sender is null 2020-09-16 20:17:37.300 8213-8401/com.fusionbank.vb D/WeexCore: IPCFutexPageQueue.cpp:81,unlock: 0 2020-09-16 20:17:37.304 8213-8401/com.fusionbank.vb E/WeexCore: script_side_in_multi_process.cpp:43,InitFramework sender is null 2020-09-16 20:17:37.304 8213-8401/com.fusionbank.vb E/weex: [WXBridgeManager] invokeInitFramework ExecuteJavaScript fail

freddyzhu commented 3 years ago

Google has released Android 11, maybe it's a big question.

freddyzhu commented 3 years ago

I found the result of fork() is not 0, so enter the condition three. m_impl->futexPageQueue->spinWaitPeer() will call sched_yield(),until timeout.

I am puzzled, what has changed in fork(), on android11 ​​phones.

IPCSender *WeexJSConnection::start(bool reinit) { ......

// static bool startupPie = s_start_pie; static bool startupPie = SoUtils::pie_support(); LOGE("startupPie :%d", startupPie);

pid_t child; if (reinit) {

if PRINT_LOG_CACHEFILE

mcfile << "reinit is ture use vfork" << std::endl;
mcfile.close();

endif

child = vfork();

} else {

if PRINT_LOG_CACHEFILE

mcfile << "reinit is false use fork" << std::endl;
mcfile.close();

endif

child = fork();

} LOGD("fork result=%d", child); if (child == -1) { int myerrno = errno; munmap(base, IPCFutexPageQueue::ipcsize); throw IPCException("failed to fork: %s", strerror(myerrno)); } else if (child == 0 || child == 6743) { LOGE("weexcore fork child success\n"); // the child closeAllButThis(client->ipcFd, server->ipcFd); // implements close all but handles[1] // do exec doExec(client->ipcFd, server_->ipcFd, true, startupPie); LOGE("exec Failed completely."); // failed to exec _exit(1); } else { //step into here ====condition three printLogOnFile("fork success on main process and start m_impl->futexPageQueue->spinWaitPeer()"); LOGD("fork success on main process and start m_impl->futexPageQueue->spinWaitPeer()"); m_impl->child = child; try { m_impl->futexPageQueue->spinWaitPeer(); } catch (IPCException &e) { LOGE("WeexJSConnection catch: %s", e.msg()); // TODO throw exception if(s_in_find_icu) { // WeexCore::WeexProxy::reportNativeInitStatus("-1013", "find icu timeout"); } return nullptr; } } return m_impl->serverSender.get(); }

lb4110991 commented 3 years ago

I found the result of fork() is not 0, so enter the condition three. m_impl->futexPageQueue->spinWaitPeer() will call sched_yield(),until timeout.

I am puzzled, what has changed in fork(), on android11 ​​phones.

IPCSender *WeexJSConnection::start(bool reinit) { ......

// static bool startupPie = s_start_pie; static bool startupPie = SoUtils::pie_support(); LOGE("startupPie :%d", startupPie);

pid_t child; if (reinit) {

if PRINT_LOG_CACHEFILE

mcfile << "reinit is ture use vfork" << std::endl; mcfile.close();

endif

child = vfork(); } else {

if PRINT_LOG_CACHEFILE

mcfile << "reinit is false use fork" << std::endl; mcfile.close();

endif

child = fork(); } LOGD("fork result=%d", child); if (child == -1) { int myerrno = errno; munmap(base, IPCFutexPageQueue::ipcsize); throw IPCException("failed to fork: %s", strerror(myerrno)); } else if (child == 0 || child == 6743) { LOGE("weexcore fork child success\n"); // the child closeAllButThis(client->ipcFd, server->ipcFd); // implements close all but handles[1] // do exec doExec(client->ipcFd, server_->ipcFd, true, startupPie); LOGE("exec Failed completely."); // failed to exec _exit(1); } else { //step into here ====condition three printLogOnFile("fork success on main process and start m_impl->futexPageQueue->spinWaitPeer()"); LOGD("fork success on main process and start m_impl->futexPageQueue->spinWaitPeer()"); m_impl->child = child; try { m_impl->futexPageQueue->spinWaitPeer(); } catch (IPCException &e) { LOGE("WeexJSConnection catch: %s", e.msg()); // TODO throw exception if(s_in_find_icu) { // WeexCore::WeexProxy::reportNativeInitStatus("-1013", "find icu timeout"); } return nullptr; } } return m_impl->serverSender.get(); }

hello, Have you solved this problem?