最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】lnmp中php警告:wp-cron.php execution timed out terminating

LNMP crifan 4082浏览 0评论

折腾:

【已解决】LNMP的wordpress网站crifan.com无法访问:502 Bad Gateway nginx

期间,看到log:

[15-Sep-2017 03:50:20] WARNING: [pool www] child 9716, script ‘xxx/www.crifan.com/wp-cron.php‘ (request: "POST /wp-cron.php") execution timed out (300.253839 sec), terminating
[15-Sep-2017 03:50:20] WARNING: [pool www] child 9716 exited on signal 15 (SIGTERM) after 19771.632900 seconds from start

所以需要去解决。

毕竟:

之前自己用evernote sync去同步帖子时,也都是没成功,弄了多次,都不行。

估计也和这部分有关系。所以要去解决掉。

后来在:

【基本解决】www.crifan.com/index.php出错:amp_render() unknown:0

中,倒是看到了:

此处的wp-cron.php中,内部是执行的

evernote-sync的

evernote_sync_task

[15-Sep-2017 03:14:52] [pool www] pid 12133
script_filename = /home/wwwroot/www.crifan.com/wp-cron.php
[0x00007f6a729ec9b8] send_listSharedNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/EDAM/NoteStore/NoteStore.php:3890
[0x00007ffd6da5e020] listSharedNotebooks() unknown:0
[0x00007f6a729ec858] invokeArgs() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Store/Store.php:25
[0x00007ffd6da5e390] __call() unknown:0
[0x00007f6a729ec708] listSharedNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:354
[0x00007f6a729ec508] listSharedNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:247
[0x00007f6a729ec3b8] listNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:971
[0x00007f6a729ec220] findNotes_listNotebooksWithContext() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:807
[0x00007f6a729ec078] findNotesWithSearch() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/EvernoteSync.php:506
[0x00007f6a729ebdb8] searchNotes() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/evernote-sync.php:93
[0x00007f6a729ebc88] sync() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/evernote-sync.php:565
[0x00007ffd6da5ef90] evernote_sync_task() unknown:0
[0x00007f6a729ebb40] call_user_func_array() /home/wwwroot/www.crifan.com/wp-includes/class-wp-hook.php:298
[0x00007f6a729eba10] apply_filters() /home/wwwroot/www.crifan.com/wp-includes/class-wp-hook.php:323
[0x00007f6a729eb8d8] do_action() /home/wwwroot/www.crifan.com/wp-includes/plugin.php:515
[0x00007f6a729eb778] do_action_ref_array() /home/wwwroot/www.crifan.com/wp-cron.php:117

貌似导致正常的

-》本身evernote sync同步一次,就很耗时的

但是最近几次,都是没有同步成功。。。

不知道具体什么原因。

-》难道是帖子太多,同步超过300秒了?

-》那不应该啊,即使帖子很多,一次同步最多同步自己设置的30个,之前都可以正常同步的,为何最近就不可以了?

wp-cron.php execution timed out evernote_sync_task

Disabling the wp-cron.php in WordPress – InMotion Hosting

Too many wp-cron requests even when disabled – WordPress Development Stack Exchange

Is it safe to run wp-cron.php twice if the first instance takes too long? – WordPress Development Stack Exchange

Running WordPress Cron via PHP-CLI – Pressjitsu

lnmp php-fpm.conf

然后再去手动同步印象笔记,结果还是失败:

无法访问此网站
网址为 https://www.crifan.com/wp-admin/options-general.php?page=evernotesync.php 的网页可能暂时无法连接,或者它已永久性地移动到了新网址。
ERR_SPDY_PROTOCOL_ERROR

lnmp wordpress ERR_SPDY_PROTOCOL_ERROR

Nginx & SPDY error: net::ERR_SPDY_PROTOCOL_ERROR

Chrome error: ‘ERR_SPDY_PROTOCOL_ERROR – EasyEngine – rtCommunity

去看log:

/usr/local/php/var/log/slow.log

又是:

[15-Sep-2017 21:15:56] [pool www] pid 2712
script_filename = /home/wwwroot/www.crifan.com/wp-cron.php
[0x00007f36452d79b8] send_listSharedNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/EDAM/NoteStore/NoteStore.php:3890
[0x00007fff0fa03380] listSharedNotebooks() unknown:0
[0x00007f36452d7858] invokeArgs() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Store/Store.php:25
[0x00007fff0fa036f0] __call() unknown:0
[0x00007f36452d7708] listSharedNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:354
[0x00007f36452d7508] listSharedNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:247
[0x00007f36452d73b8] listNotebooks() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:971
[0x00007f36452d7220] findNotes_listNotebooksWithContext() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/src/Evernote/Client.php:807
[0x00007f36452d7078] findNotesWithSearch() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/EvernoteSync.php:506
[0x00007f36452d6db8] searchNotes() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/evernote-sync.php:93
[0x00007f36452d6c88] sync() /home/wwwroot/www.crifan.com/wp-content/plugins/evernote-sync/evernote-sync.php:565
[0x00007fff0fa042f0] evernote_sync_task() unknown:0
[0x00007f36452d6b40] call_user_func_array() /home/wwwroot/www.crifan.com/wp-includes/class-wp-hook.php:298
[0x00007f36452d6a10] apply_filters() /home/wwwroot/www.crifan.com/wp-includes/class-wp-hook.php:323
[0x00007f36452d68d8] do_action() /home/wwwroot/www.crifan.com/wp-includes/plugin.php:515
[0x00007f36452d6778] do_action_ref_array() /home/wwwroot/www.crifan.com/wp-cron.php:117

spdy – What mean ERR_SPDY_PROTOCOL_ERROR in nginx? – Stack Overflow

nginx – Error code: ERR_SPDY_PROTOCOL_ERROR – Server Fault

ERR_SPDY_PROTOCOL_ERROR reason and solution

some resources are not loading for the first time. but ok on refresh | DigitalOcean

解决 Chrome 浏览器的 ERR_SPDY_PROTOCOL_ERROR 错误 | 技术拉近你我!

Permanently fix chrome’s ERR_SPDY_PROTOCOL_ERROR

THttpClient fopen

php – THttpClient failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request – Stack Overflow

If error WARNING is enable fopen break in case of connection failure · Issue #38 · yiisoft/yii2-httpclient

Support for domain name on localhost · Issue #84 · yiisoft/yii2-httpclient

php-thrift-sql/THttpClient.php at master · Automattic/php-thrift-sql

stoimen’s web log

去找源码,搞清楚上面的代码调用顺序:

【已解决】搞清楚evernote-sync中在无响应之前的代码的调用顺序

evernote-sync THttpClient fopen

NoteStore THttpClient fopen

Could not read 4 bytes from sandbox.evernote.com · Issue #15 · evernote/evernote-cloud-sdk-php

这里面好像也是和我这里遇到同样问题,都是死在fopen

EDAMTest.php in evernote-sdk-php | source code search engine

但是此处感觉又不像是代码的问题,而是lnmp的哪里的配置问题?

或者是网络问题?

先去全局代理,然后再去试试evernote同步

但是不对,代理影响的只是本地网络,不是服务器网络。

又看了其他几个slow log,结果都是死在fopen的地方。

难道是(某个区的?)硬盘空间不够了?

去看了看,不是:

[root@crifan crifan_wwwroot]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        20G   11G  7.8G  59% /
devtmpfs        2.0G     0  2.0G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G   58M  1.9G   3% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           395M     0  395M   0% /run/user/0

然后继续:

【已解决】搞清楚evernote-sync中在无响应之前的代码的调用顺序

搞清楚了到底死在哪里后,然后就去研究看看,此处的

THttpClient.php

中的flush到底为何fopen出错了。

THttpClient.php flush fopen

其中,此处代码的逻辑,应该没有出错

->因为之前代码都可以正常运行,可以正常同步evernote的。

PHP SDK Example does not work! – Evernote API Discussion – Evernote User Forum

这人也是THttpClient的flush出错了。

EDAMTest (php) UserStore Failure – Evernote API Discussion – Evernote User Forum

说是:

THttpClient.php的flush()中,把原先正常的header:

Content-Type: application/x-thrift

(不知何故的换成了,错误的)

ContentType: application/x-www-form-urlencoded

其找了个workaround:

ini_set("user_agent", "PHP/THttpClient\r\nAccept: application/x-thrift\r\nContent-Type: application/x-thrift”);

说是参考了:

php – file_get_contents returns empty string – Stack Overflow

Evernote Sync – WordPress Plugin Analysis

去试试那个workaround

先要找到,如何添加设置:

ini_set

Developers – Could not read 4 bytes from sandbox.evernote.com –

1.参考其去加上点注释代码

2.这里多了一行

    stream_context_set_option ( $contextid, ‘ssl’, ‘verify_peer’, false );

难道这里的Thrift的版本是新版本?

先去看看第二个,是不是有新的thrift版本

找不到这个库叫做什么

看到有3个文件夹:

搜:

EDAM Thrift Evernote

Evernote Synchronization via EDAM

“Evernote Data Access and Management (EDAM) is a protocol for exchanging Evernote data with theEvernote service. The data structures and remote procedures supported by EDAM are expressedusing the Thrift interface definition language. These Thrift IDL files can be used to generatelanguage-specific data and programming interfaces for communication. The generated classes areused to perform marshalling and unmarshalling of the data and procedure calls using an abstractnotion of “protocols” and “transports”.

The Thrift runtime libraries include specific protocol and transport implementations to allow Thrift RPCcalls using a binary encoding over HTTP and/or raw TCP/IP sockets.

For a list of the data types and remote procedures that make up EDAM, visit http://dev.evernote.com/documentation/reference/.”

EDAM Thrift Evernote php

Fatal errors – am I doing something wrong? · Issue #24 · evernote/evernote-cloud-sdk-php

TODO:待会去把 这部分fopen的代码加上try catch,看看到底出了什么错了。

-》然后通过$e->errorCode and $e->message 或许知道具体错误原因是什么

突然想到,难道是:新版本evernote之后,token失效了?

那先去换个新的token试试

php – file_get_contents returns empty string – Stack Overflow

看了phpinfo,我这里已经有了对应的stream的支持了:

Registered PHP Streams
https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports
tcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters
zlib.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

PHP Lib – THttpClient: Could not read xx bytes from sandbox.evernote.com:443//edam/user – Evernote API Discussion – Evernote User Forum

这里是:

生产环境是:PHP 5.3

本地环境是:PHP 5.4

所以 header不能正确添加,最后也是加上了:

ini_set("user_agent", "PHP/THttpClient\r\nAccept: application/x-thrift\r\nContent-Type: application/x-thrift");

解决了问题:

TODO:待会也去加上这个ini_set试试。

【记录】印象笔记重新生成DeveloperToken

去试试,在已撤销了token的情况下,用旧的无效的token去同步,看看会发生什么。

结果竟然:

瞬间就同步好了,且显示:同步成功

真是诡异了。。。

-》当然对应的帖子,肯定是没有同步过来了:

(没有出现 草稿 )

-》因为正常同步的话,此处同步20个帖子,也还是要个一小段时间的。

现在,搞得只能是:

等官网:

https://app.yinxiang.com/api/DeveloperToken.action

正常允许创建token后,我才能继续测试,继续试试前面提到等几个TODO的方法,看看能否解决问题。

【后记】

后来从:

【未解决】印象笔记无法创建token了:Update: the creation of developer tokens is temporarily disabled

得到,是永远无法创建了。

转载请注明:在路上 » 【未解决】lnmp中php警告:wp-cron.php execution timed out terminating

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.412 seconds, using 22.12MB memory