Skip to content

privval: set deadline in readMsg#2548

Merged
ebuchman merged 2 commits intodevelopfrom
bucky/2027-fix-socket-pv
Oct 11, 2018
Merged

privval: set deadline in readMsg#2548
ebuchman merged 2 commits intodevelopfrom
bucky/2027-fix-socket-pv

Conversation

@ebuchman
Copy link
Contributor

@ebuchman ebuchman commented Oct 5, 2018

This is a quick-fix for #2027.

The problem is that we set the deadline once, but need to reset each time we want to read, else the first deadline will expire at some random later read.

Also note this is using the default. It seems the ability to use the options has been eliminated? We probably want to bring that back, and actually use an internal, configured value for the read deadline rather than the default.

@codecov-io
Copy link

codecov-io commented Oct 5, 2018

Codecov Report

Merging #2548 into develop will increase coverage by 0.03%.
The diff coverage is 50%.

@@             Coverage Diff             @@
##           develop    #2548      +/-   ##
===========================================
+ Coverage    61.19%   61.23%   +0.03%     
===========================================
  Files          202      202              
  Lines        16703    16681      -22     
===========================================
- Hits         10222    10214       -8     
+ Misses        5611     5599      -12     
+ Partials       870      868       -2
Impacted Files Coverage Δ
privval/socket.go 75.08% <50%> (-0.72%) ⬇️
libs/db/remotedb/remotedb.go 36.84% <0%> (-4.69%) ⬇️
consensus/state.go 77.22% <0%> (-0.24%) ⬇️
libs/db/remotedb/grpcdb/client.go 0% <0%> (ø) ⬆️
blockchain/pool.go 66.43% <0%> (+0.69%) ⬆️
state/validation.go 49.09% <0%> (+5.34%) ⬆️

// set deadline before trying to read
conn := r.(net.Conn)
if err := conn.SetDeadline(time.Now().Add(time.Second * defaultConnDeadlineSeconds)); err != nil {
err = cmn.ErrorWrap(err, "setting connection timeout failedin readMsg")
Copy link
Contributor

Choose a reason for hiding this comment

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

failed in

defaultConnWaitSeconds = 60
defaultDialRetries = 10
defaultAcceptDeadlineSeconds = 30 // tendermint waits this long for remote val to connect
defaultConnDeadlineSeconds = 3 // must be set before each read
Copy link
Contributor

Choose a reason for hiding this comment

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

ConnReadDeadline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we set it on writes too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, if we have writes, then please ignore my comment. I haven't seen one...

@xla
Copy link
Contributor

xla commented Oct 8, 2018

Looks like it's superseed by #2568.

@ValarDragon
Copy link
Contributor

Shouldn't we merge this small focused PR, and split up concerns in #2568?

@ebuchman
Copy link
Contributor Author

Shouldn't we merge this small focused PR, and split up concerns in #2568?

Yes I think so.

@ebuchman ebuchman merged commit 7b48ea1 into develop Oct 11, 2018
@ebuchman ebuchman deleted the bucky/2027-fix-socket-pv branch October 11, 2018 17:55
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.

5 participants