Skip to content

Extract of deep mind logger in libraries/fc directly - #148

Merged
allenhan2 merged 6 commits into
EOSIO:masterfrom
dfuse-io:feature/deep-mind
Mar 19, 2020
Merged

allenhan2 merged 6 commits into
EOSIO:masterfrom
dfuse-io:feature/deep-mind

Conversation

@maoueh

@maoueh maoueh commented Mar 13, 2020

Copy link
Copy Markdown

Ping @heifner

Linked with EOSIO/eos#8788

@maoueh
maoueh force-pushed the feature/deep-mind branch from 742854b to 77557d0 Compare March 16, 2020 02:11
Comment thread include/fc/log/dmlog_appender.hpp Resolved
Comment thread include/fc/log/dmlog_appender.hpp Resolved
Comment thread include/fc/log/dmlog_appender.hpp Resolved
Comment thread include/fc/log/logger.hpp Resolved
Comment thread src/log/logger_config.cpp Resolved
@maoueh maoueh mentioned this pull request Mar 16, 2020
3 tasks
Comment thread src/log/dmlog_appender.cpp Resolved
Matthieu Vachon added 3 commits March 17, 2020 10:37
- Removal of dmlog macro
- Using `io_service.stop` instead of hard `exit(1)`
- Remove logger default config changes
@maoueh
maoueh force-pushed the feature/deep-mind branch from aacf4f1 to 20041fc Compare March 17, 2020 14:38
maoueh pushed a commit to dfuse-io/eos that referenced this pull request Mar 17, 2020
@maoueh

maoueh commented Mar 17, 2020

Copy link
Copy Markdown
Author

Pushed with latest changes.

Comment thread include/fc/log/logger.hpp Resolved
@maoueh

maoueh commented Mar 19, 2020

Copy link
Copy Markdown
Author

@heifner Reverted the changes.

If you are about to merge, tell me before it, I'll squash all the changes into a single commit.

@heifner heifner changed the title Extract of deep mind logger (and macro) in libraries/fc directly Extract of deep mind logger in libraries/fc directly Mar 19, 2020
@heifner

heifner commented Mar 19, 2020

Copy link
Copy Markdown
Contributor

@maoueh squash is not needed. You should be able to merge. I assume now you will update the eos PR.

int retries = 0;
auto remaining_size = message.size();
auto message_ptr = message.c_str();
while (true) {

@allenhan2 allenhan2 Mar 19, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For some reason, fwrite returns zero (due to certain error), then retries causing asio stop, never can get out of the loop.
if (written == remaining_size) alone is not good enough, please handle the error cases

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Indeed, good catch, the loop had exit(1) before which was getting out of the loop.

I changed this. After calling stop, I return immediately and set an is_stopped variable to true.

Then, upon the next log call, if stopped, I log a message indicating termination of the dmlog appender and return right away.


fprintf(stderr, "DMLOG FPRINTF_FAILED failed written=%lu remaining=%lu %d %s\n", written, remaining_size, ferror(out), strerror(errno));

if (retries++ > 5) {

@allenhan2 allenhan2 Mar 19, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

anything else needs to do when retry limits being reached?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not really, it's time to exit and check the machine, there is something bad happening.

I however added a is_stopped state to the logger since the io_service->stop is not in effect immediately.

Should be enough like that.

@maoueh

maoueh commented Mar 19, 2020

Copy link
Copy Markdown
Author

@heifner @allenhan2 Don't have rights to merge. Once merged, I'll update EOS PR with merged commit.

@allenhan2
allenhan2 merged commit 3a69512 into EOSIO:master Mar 19, 2020
@allenhan2

Copy link
Copy Markdown
Contributor

merged, thanks for all works

@maoueh
maoueh deleted the feature/deep-mind branch March 19, 2020 15:33
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.

4 participants