Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused beast::currentTimeMillis() #2345

Closed
wants to merge 1 commit into from

Conversation

scottschurr
Copy link
Collaborator

This change removes some obsolete code identified by @MarkusTeufelberger (thanks!).

@HowardHinnant
Copy link
Contributor

Less code to cause a bug, awesome!

@ripplelabs-jenkins
Copy link
Collaborator

ripplelabs-jenkins commented Jan 20, 2018

Jenkins Build Summary

Built from this commit

Built at 20180124 - 00:08:14

Test Results

Build Type Result Status
clang.debug.unity 985 cases, 0 failed, t: 391s PASS ✅
coverage 985 cases, 0 failed, t: 622s PASS ✅
clang.debug.nounity 983 cases, 0 failed, t: 370s PASS ✅
gcc.debug.unity 985 cases, 0 failed, t: 438s PASS ✅
gcc.debug.nounity 983 cases, 0 failed, t: 351s PASS ✅
clang.release.unity 984 cases, 0 failed, t: 477s PASS ✅
gcc.release.unity 984 cases, 0 failed, t: 500s PASS ✅

@MarkusTeufelberger
Copy link
Collaborator

Thanks, I suspect that there's even more dead code in src/ripple/beast... this one just stood out because apparently the files in core are all included in core.unity.cpp with some more system libraries and break when compiled individually. Since I am working on compiling rippled with Bazel in nounity mode I excluded all "unity" files which then exposed some missing imports.

It might be interesting to know which code gets removed by ThinLTO, but I'm not sure if that's an available query. Until then it might be probably worth to cut the Ripple beast back a bit manually if you are concerned about obsolete code.

@@ -588,10 +587,6 @@ int run (int argc, char** argv)
//
int main (int argc, char** argv)
{
// Workaround for Boost.Context / Boost.Coroutine
// https://svn.boost.org/trac/boost/ticket/10657
(void)beast::currentTimeMillis();
Copy link
Collaborator

Choose a reason for hiding this comment

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

From the comment, the purpose of this code is to call GetTimeZoneInformation before the first coroutine is launched. The bug is marked as "wontfix". So don't we still need this call?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a great question. It's entirely unclear to me how this call: https://github.com/ripple/rippled/pull/2345/files#diff-0da1f01eb51089298d4839f18d92fa41L41 could have the side effect of loading time zone information. But this would not be the only example of twisted software. How would we determine whether we still need the call? I'd prefer not to leave it in place simply because we're afraid to remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like a windows only issue...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do we know what the failure mode would be? Perhaps @bachase can try building this branch and see if it behaves well for him, since he runs Windows.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like it happens on the windows _f_time call. The timeptr struct contains timezone information: https://msdn.microsoft.com/en-us/library/z54t9z5f.aspx

I'd prefer to leave this in, even if coro's don't currently call GetTimezoneInformation. If it's added later it would be a PITA to track down the crash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I prefer not to leave it in it's current form. If it's a Windows only problem we can make a Windows-only call in the #ifdef _MSC_VER immediately below. With a paragraph comment explaining the justification. But I may need to punt and ask someone else on the team to do that, since I don't run a Windows box.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not observing a crash on windows with this change when running the unit tests. Using the example code on the boost ticket, I also do not observe a crash with VS 2017 on Windows 10. I do not have other versions of windows available to test. Even though I'm unable to recreate, I'm with @seelabs and would prefer not have this bite us in the future.

I can try more testing to see if I can recreate, but frankly this seems fairly low priority relative to other work. I'm fine with @scottschurr's suggestion of just moving the code inside the existing windows specific startup block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @bachase. I have to agree with your assessment of the priority of this work. I'll make a stab at a Windows only version of the code.

@scottschurr
Copy link
Collaborator Author

Tip commit re-adds the Windows song-and-dance with a paragraph comment. But excludes Unix-like operating systems from involvement.

Copy link
Collaborator

@bachase bachase left a comment

Choose a reason for hiding this comment

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

Unit tests pass and I am able to sync with network using VS2017 and windows 10.

Copy link
Collaborator

@seelabs seelabs left a comment

Choose a reason for hiding this comment

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

👍

@scottschurr scottschurr added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Jan 23, 2018
@scottschurr
Copy link
Collaborator Author

Squashed and marked as passed.

@seelabs
Copy link
Collaborator

seelabs commented Jan 30, 2018

In 0.90.0-b5

@seelabs seelabs closed this Jan 30, 2018
@scottschurr scottschurr deleted the rm-beast-time branch February 17, 2018 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants