Skip to content

Conversation

zhangzifa
Copy link
Contributor

@zhangzifa zhangzifa commented Apr 3, 2018

check core files

1. if user specified "coredir": [dir1, dir2], or

2. /proc/sys/kernel/core_pattern is something like /tmp/coredump_%d_%P, or

3. by default

  • linux: check running node process PWD
  • darwin: check /cores

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 87.393% when pulling 25713a3 on list-core-file into 2c648af on master.

@coveralls
Copy link

coveralls commented Apr 3, 2018

Coverage Status

Coverage increased (+0.1%) to 87.42% when pulling 4590b7b on list-core-file into 2c648af on master.

exports.coredir = [];
coreFileNamePrefix = 'core';
var patt = fs.readFileSync('/proc/sys/kernel/core_pattern', 'utf8').trim().split(' ')[0];
if (patt.indexOf('%') > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也有不指定 %e %p 的情况把

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前只处理这种格式的


for (var i = 0; i < count; i++) {
getNodePWD(pids[i], done);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对其了吗。

var done = function(err, pwd) {
finished++;
if (pwd && pwds.indexOf(pwd) === -1) {
pwds.push(pwd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 pwd 应该是有重复的。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要去重

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (pwd && pwds.indexOf(pwd) === -1) 这句去重的

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个效率不高。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(⊙o⊙)…哪个效率高一些?

@JacksonTian
Copy link
Contributor

我们只对新产生的 core 文件进行上报吧。可能要根据文件生成的时间来过滤。

@zhangzifa zhangzifa force-pushed the list-core-file branch 2 times, most recently from 7eb1eb8 to 9c95846 Compare April 4, 2018 09:17
@JacksonTian
Copy link
Contributor

测试没有过?

@JacksonTian JacksonTian merged commit c3529f4 into master Apr 8, 2018
@JacksonTian JacksonTian deleted the list-core-file branch April 8, 2018 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants