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

Update ouroboros-network dependency #588

Merged
merged 6 commits into from
Feb 27, 2020

Conversation

mrBliss
Copy link
Contributor

@mrBliss mrBliss commented Feb 19, 2020

Issue

Pushing through the changes made in IntersectMBO/ouroboros-network#1657

checklist

  • This PR contains all the work required to resolve the linked issue.

  • This PR results in breaking changes to upstream dependencies.

  • The work contained has sufficient documentation to describe what it does and how to do it.

  • The work has sufficient tests and/or testing.

  • I have committed clear and descriptive commits. Be considerate as somebody else will have to read these.

  • I have added the appropriate labels to this PR.

@mrBliss mrBliss requested review from coot and Jimbo4350 February 19, 2020 12:21
@mrBliss
Copy link
Contributor Author

mrBliss commented Feb 19, 2020

@coot There are some breaking changes in the network code, can you fix these?

@mrBliss mrBliss force-pushed the mrBliss/update-ouroboros-network-20200219 branch 3 times, most recently from ff0b62d to 29f02eb Compare February 19, 2020 13:43
@edsko
Copy link
Contributor

edsko commented Feb 19, 2020

This will need updating after IntersectMBO/ouroboros-network#1674 is merged (I don't think that should be too bad).

@karknu
Copy link
Contributor

karknu commented Feb 19, 2020

@mrBliss your branch builds and runs fine for me. What was it that you needed help with?

@mrBliss
Copy link
Contributor Author

mrBliss commented Feb 20, 2020

@mrBliss your branch builds and runs fine for me. What was it that you needed help with?

I suppose the main node itself runs fine, but the other tools probably wont, as I left a bunch of undefineds in there. Can you have a look through at the diff and look for undefined and other commented out code?

@mrBliss mrBliss force-pushed the mrBliss/update-ouroboros-network-20200219 branch from b23ae48 to 8fb22e6 Compare February 20, 2020 15:00
@mrBliss mrBliss marked this pull request as ready for review February 20, 2020 15:01
coot
coot previously requested changes Feb 20, 2020
Copy link
Contributor

@coot coot left a comment

Choose a reason for hiding this comment

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

withIOManager starts IO manager thread. On Unix its noop, on Windows however it start a thread which fulfills asynchronous requests (like the GHC's RTS IO manager thread). It must be started once, when its started multiple times the behavior is undefined; for that reason it must be started when the application starts and the AssociateWithIOCP function can be passed down to call sites when we create Snockets (an abstraction over Berkeley sockets and Windows' named pipes).

@@ -204,15 +206,16 @@ benchmarkConnectTxSubmit
-> TxSubmissionClient (GenTxId blk) (GenTx blk) m ()
-- ^ the particular txSubmission peer
-> m ()
benchmarkConnectTxSubmit trs nc localAddr remoteAddr myTxSubClient = do
benchmarkConnectTxSubmit trs nc localAddr remoteAddr myTxSubClient = withIOManager $ \iocp -> do
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is wrong place to call withIOManager. It should be started at the very top level when the application starts. We don't want two IO manager threads to complete.

Nothing
addr
`catch` handleMuxError tracer chainsVar socketPath
socketPath = withIOManager $ \iocp -> do
Copy link
Contributor

Choose a reason for hiding this comment

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

The same here, withIOManager must be called when chairman starts and then iocp :: AssociateWithIOCP should be passed down.

@@ -106,15 +107,15 @@ submitTx :: ( RunNode blk
-> GenTx blk
-> Tracer IO TraceLowLevelSubmit
-> IO ()
submitTx targetSocketFp protoInfoConfig tx tracer = do
targetSocketFp' <- localSocketAddrInfo targetSocketFp
submitTx targetSocketFp protoInfoConfig tx tracer = NodeToClient.withIOManager $ \iocp -> do
Copy link
Contributor

Choose a reason for hiding this comment

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

The same applies here.

@@ -58,16 +59,17 @@ runWalletClient :: forall blk.
-> SocketPath
-> Tracer IO String
-> IO ()
runWalletClient ptcl sockFp tracer = do
runWalletClient ptcl sockFp tracer = withIOManager $ \iocp -> do
Copy link
Contributor

Choose a reason for hiding this comment

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

This is ok, runWalletClient is where the wallet-client starts.

Comment on lines +61 to +62
, withIOManager
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Jimbo4350 What does the style guide say about this? Does the stylish-haskell config in this repo do the right thing?

Copy link
Contributor

@Jimbo4350 Jimbo4350 Feb 25, 2020

Choose a reason for hiding this comment

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

I don't think it does however I need to update the style guide re: imports. We want this format if imports exceed 100 chars:

import           Ouroboros.Network.NodeToClient 
                  (AssociateWithIOCP, withIOManager)

@coot coot dismissed their stale review February 24, 2020 11:28

Comments were addressed.

@mrBliss mrBliss force-pushed the mrBliss/update-ouroboros-network-20200219 branch from a0e40ff to f19b598 Compare February 25, 2020 08:29
@mrBliss mrBliss requested a review from coot February 25, 2020 09:29
@mrBliss
Copy link
Contributor Author

mrBliss commented Feb 25, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Feb 25, 2020
588: Update ouroboros-network dependency r=mrBliss a=mrBliss


Issue
------

Pushing through the changes made in IntersectMBO/ouroboros-network#1657


checklist
---------
- [ ] This PR contains all the work required to resolve the linked issue.

- [ ] This PR results in breaking changes to upstream dependencies.

- [ ] The work contained has sufficient documentation to describe what it does and how to do it.

- [ ] The work has sufficient tests and/or testing.

- [ ] I have committed clear and descriptive commits. Be considerate as somebody else will have to read these.

- [ ] I have added the appropriate labels to this PR.


Co-authored-by: Thomas Winant <thomas@well-typed.com>
Co-authored-by: Marcin Szamotulski <profunctor@pm.me>
@Jimbo4350
Copy link
Contributor

bors r-

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 25, 2020

Canceled

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM! Just some conflicts to fix.

mrBliss and others added 4 commits February 26, 2020 11:32
After IntersectMBO/ouroboros-network#1657

Co-authored-by: Karl Knutsson <karl.knutsson@iohk.io>
Behaviour of IO manager depends on platform.  On Unix its noop, as RTS
has an io manager already; on Windows: it starts a thread which fulfills
aysynchronous IO request (throuh IO completion port).
`withIOManager` is used when an application starts and it must be called
only once, so the best place to start is at the very begining of `main`.
@intricate intricate force-pushed the mrBliss/update-ouroboros-network-20200219 branch from 6bdbf89 to 0346c6d Compare February 26, 2020 17:34
@intricate intricate force-pushed the mrBliss/update-ouroboros-network-20200219 branch from 0346c6d to 91cd6ac Compare February 26, 2020 17:38
Copy link
Contributor

@intricate intricate left a comment

Choose a reason for hiding this comment

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

LGTM after rebasing and fixing conflicts.

@Jimbo4350 would you mind giving this a final look?

@mrBliss
Copy link
Contributor Author

mrBliss commented Feb 27, 2020

I'm going to push another bump of ouroboros-network to this PR. It's already out of date, as it has been open for a week 🙁

EDIT: done

@mrBliss
Copy link
Contributor Author

mrBliss commented Feb 27, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 27, 2020

@iohk-bors iohk-bors bot merged commit b736a1c into master Feb 27, 2020
@iohk-bors iohk-bors bot deleted the mrBliss/update-ouroboros-network-20200219 branch February 27, 2020 09:10
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.

6 participants