Commit Graph

8832 Commits

Author SHA1 Message Date
Waldemar Zurowski
36d70a6d9b Merge branch 'release/os/4.5' into wz/merge-os-45-46-2020-07-15 2020-07-15 21:36:49 +01:00
Waldemar Zurowski
44b5fd1678 Merge branch 'release/os/4.4' into wz/merge-os-44-45-2020-07-15 2020-07-15 21:35:07 +01:00
Waldemar Zurowski
b58609daba Correct name of Artifactory repository for publishing releases 2020-07-15 21:33:49 +01:00
Waldemar Żurowski
e0e01c47c2
Merge pull request #6469 from corda/wz/merge-45-46-2020-07-15
INFRA-427: Store 14 days of builds
2020-07-15 15:23:17 +01:00
Waldemar Zurowski
c8ca7cc579 Merge branch 'release/os/4.4' into wz/merge-45-46-2020-07-15 2020-07-15 12:12:29 +01:00
Waldemar Żurowski
9a0d1a01b0
Merge pull request #6468 from corda/wz/merge-44-45-2020-07-15
INFRA-427: Store 14 days of builds
2020-07-15 12:10:33 +01:00
Chris Rankin
6bae99ef10
CORDA-3909: Upgrade to Corda Gradle plugins 5.0.11. (#6463)
This also upgrades the following plugins:
- Artifactory: 4.7.3 -> 4.16.1
- Bintray: 1.4 -> 1.8.5
2020-07-15 10:46:29 +01:00
Waldemar Zurowski
f3d8d0d57d Merge branch 'release/os/4.4' into wz/merge-44-45-2020-07-15 2020-07-15 10:24:45 +01:00
Waldemar Żurowski
ef9934ed4e
Added build discarder settings back (#6465)
builds are expired only after 14 days
2020-07-15 10:17:58 +01:00
Chris Rankin
57e5f27961
CORDA-3906: Allow usage of SchedulableState in deterministic CorDapps. (#6457) 2020-07-15 09:09:28 +01:00
Waldemar Żurowski
75bade2f92
Added NexusIQ scan to nightly snapshot build (#6461)
* also build on standard agent, no K8S requirements
2020-07-15 07:46:26 +01:00
Dan Newton
ac4907a429
CORDA-3721 Finishing + retrying a flow cancels its future (#6454)
Cancel the future being run by a flow when finishing or retrying it. The
cancellation of the future no longer cares about what type of future it
is.

`StateMachineState` has the `future` field, which holds the 3
(currently) possible types of futures:
- sleep
- wait for ledger commit
- async operation / external operation

Move the starting of all futures triggered by actions into
`ActionFutureExecutor`.
2020-07-14 08:04:52 +01:00
Yiftach Kaplan
79b75ff1ec
INFRA-429: Wait for log file to indicate that the process is running (#6433)
Wait for log file to indicate that a driver node process is running, instead of trying to open a socket on the port the node is attempting to binding on. This means the driver is more responsive to the node being ready, as well as removing a race condition where the binding test could block the node from starting.

As sometimes nodes do not log this information, after 20 seconds we presume the node is up.
2020-07-13 11:42:30 +01:00
Chris Rankin
e684cfd1e6
NOTICK: Avoid configuring more tasks in the deterministic modules. (#6452) 2020-07-13 10:33:23 +01:00
Ross Nicoll
db13e3beb9
INFRA-456 Add codeowners (#6450) 2020-07-09 15:34:34 +01:00
Dan Newton
52240dc3d1
Merge pull request #6451 from corda/dan/os-4.5-to-4.6-merge-2020-07-08
NOTICK OS 4.5 to 4.6 merge 2020-07-08
2020-07-09 14:02:22 +01:00
Dan Newton
796a0178c5
NOTICK Add KDoc to CordaFuture.doOnComplete (#6449) 2020-07-08 16:53:52 +01:00
LankyDan
8b231dc936 NOTICK Suppress detekt warning on StaffedFlowHospital 2020-07-08 16:18:16 +01:00
LankyDan
b6d649634f ENT-5196 handle errors during flow initialisation (#6378)
Update flow error handling tests after merging from earlier releases
2020-07-08 16:02:17 +01:00
LankyDan
b05c0f0cc1 ENT-5196 handle errors during flow initialisation (#6378)
Changes to `StaffedFlowHospital` after merging from earlier releases.
2020-07-08 14:43:24 +01:00
LankyDan
2204f44332 ENT-5196 handle errors during flow initialisation (#6378)
Changes to `TopLevelTransition` after merging from earlier releases.

When a flow is kept for observation and its checkpoint is saved as
HOSPITALIZED in the database, we must acknowledge the session init and
flow start events so that they are not replayed on node startup.

Otherwise the same flow will be ran twice when the node is restarted,
one from the checkpoint and one from artemis.
2020-07-08 14:41:29 +01:00
Chris Rankin
72938fdf38
CORDA-3892: Upgrade to Gradle 5.6.4 again, with build fixes. (#6448) 2020-07-08 11:34:25 +01:00
LankyDan
fdae04fc28 Merge branch 'release/os/4.5' into dan/os-4.5-to-4.6-merge-2020-07-08 2020-07-08 10:44:47 +01:00
Chris Rankin
2d63804560
CORDA-3892: Revert back to Gradle 5.4.1 to fix "clean" task. (#6439) 2020-07-07 11:29:21 +01:00
Chris Rankin
16eb9dfc08
NOTICK: Fix some Gradle technical debt. (#6430) 2020-07-07 09:08:58 +01:00
Chris Rankin
8175d4f0fb
CORDA-3892: Upgrade Gradle 5.4.1 -> 5.6.4. (#6435) 2020-07-07 09:07:55 +01:00
Kyriakos Tharrouniatis
b619356bff
Reduce exception_message and stack_trace lengths in table node_flow_exceptions (#6432)
Reduce exception_message and stack_trace lengths in table node_flow_exceptions from 4000 to 2000 to fix Oracle failing with: 'ORA-00910: specified length too long for its datatype'
2020-07-07 09:07:01 +01:00
Dan Newton
9a8ae0fd32
CORDA-3841 Update session init flow error handling tests (#6431)
These tests were removed after doing a merge from 4.4. They needed
updating after the changes from 4.4 anyway. These have been included in
this change.

Also fix kill flow tests and send initial tests.
2020-07-07 08:47:09 +01:00
Dan Newton
a1e1bf4e6d
CORDA-3848 Uncaught exception hospitalises flow (#6377)
When an uncaught exception propagates all the way to the flow exception
handler, the flow will be forced into observation/hospitalised.

The updating of the checkpoints status is done on a separate thread as
the fiber cannot be relied on anymore. The new thread is needed to allow
database transaction to be created and committed. Failures to the status
update will be rescheduled to ensure that this information is eventually
reflected in the database.
2020-07-06 22:43:48 +01:00
Ryan Fowler
0d5bed5243
ENT-5131: Avoid NPE by throwing a catchable exception when openAttachment fails. (#6408) 2020-07-06 11:42:36 +01:00
Ross Nicoll
6aa19723e6
INFRA-417 Improve driver DSL test stability (#6415)
* Move log messages that are not useful in typical usage from info to debug level to reduce log spam.
* Add node startup check before attempting to connect.
2020-07-03 20:42:29 +01:00
Viktor Kolomeyko
a2058490ed
CORDA-3880: Streamline re-connection logic in RPCClientProxyHandler (#6426)
* CORDA-3880: Streamline re-connection logic in RPCClientProxyHandler

* CORDA-3880: Address PR review comments from @dimosr

* CORDA-3880: Explicitly mention contract around `maxReconnectAttempts`

* CORDA-3880: Handle `maxReconnectAttempts = 0` and do not re-connect
2020-07-03 09:29:43 +01:00
Jonathan Locke
f8d86c0617
INFRA-415: Add empty javadoc to node-driver (#6429)
Maven central will not allow the node-driver to be published without a Javadoc `.jar` file, even if it is empty. This adds an empty Javadoc `.jar` to the output.
2020-07-02 16:17:34 +01:00
Dan Newton
6bc2c79e23
NOTICK NodeBasedTest take in cordapps (#6424)
In enterprise, `AuthDBTests` picked up a schema from a unit test and
included it in the cordapp it builds. This schema does not have a
migration and therefore fails the integration tests.

`NodeBasedTest` now lets cordapps to be defined and passed in to avoid
this issue. It defaults to making a cordapp from the tests base
directory if none are provided.
2020-07-02 16:14:51 +01:00
Dan Newton
bfc311e660
Merge pull request #6428 from corda/dan/os-4.4-to-4.5-merge-2020-07-01
OS 4.4 to 4.5 merge 2020-07-01
2020-07-02 12:35:21 +01:00
Tamas Veingartner
d97bc7dd12
ENT-5420 stop reconnecting when RejectedCommandException occurs. (#6394)
* ENT-5420 stop reconnecting when RejectedCommandException occurs.

* change to store last exception and return quietly

* changed to rethrow exception. Test added
2020-07-02 11:35:04 +01:00
LankyDan
cfe66fc662 Merge branch 'release/os/4.4' into dan/os-4.4-to-4.5-merge-2020-07-01 2020-07-02 10:39:40 +01:00
Dan Newton
ce146bdd59
Merge pull request #6427 from corda/dan/CORDA-3722-session-rollbacks-backport-4.4
BACKPORT - NOTICK Non-database error handling in `withEntityManager` (#6239)
2020-07-02 09:50:22 +01:00
Denis Rekalov
adc0879e8e
CORDA-3867: Add tests for AMQ_VALIDATED_USER (#6418)
* CORDA-3867: Add tests for AMQ_VALIDATED_USER

* CORDA-3867: detekt
2020-07-02 09:20:23 +01:00
Ross Nicoll
9f12e6bbc5
INFRA-433 Rebuild node config parsing tests (#6423)
Replace node configuration parsing tests with lighter weight equivalents which just parse the configuration rather than starting a full node.
2020-07-01 22:47:09 +01:00
Dan Newton
5f4401d16a NOTICK Non-database error handling in withEntityManager (#6239)
When a non-database exception is thrown out of a `withEntityManager`
block, always check if the session needs to be rolled back.

This means if a database error is caught and a new non-database error is
thrown out of the `withEntityManager` block, the transaction is still
rolled back. The flow can then continue progressing as normal.
2020-07-01 18:18:21 +01:00
LankyDan
c06830d851 Merge branch 'release/os/4.4' into dan/os-4.4-to-4.5-merge-2020-07-01
# Conflicts:
#	core/src/main/kotlin/net/corda/core/node/ServiceHub.kt
#	node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineGeneralErrorHandlingTest.kt
#	node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineKillFlowErrorHandlingTest.kt
#	node/src/integration-test/kotlin/net/corda/node/flows/FlowEntityManagerTest.kt
#	node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt
#	node/src/main/kotlin/net/corda/node/services/statemachine/TransitionExecutorImpl.kt
#	node/src/main/kotlin/net/corda/node/services/statemachine/interceptors/HospitalisingInterceptor.kt
2020-07-01 17:32:36 +01:00
Kyriakos Tharrouniatis
5499e2c050
ENT-5384 Rename MAX_SQL_IN_CLAUSE_SET (#6414)
Rename constant to `DEFAULT_SOFT_LOCKING_SQL_IN_CLAUSE_SIZE`
2020-07-01 09:31:12 +01:00
Razvan Codreanu
33cfa27f0b
INFRA-357 adding nexusIQ stage to JDK 11 regression job (#6421) 2020-06-30 20:13:58 +01:00
Razvan Codreanu
bf4d733336
INFRA-371 publish nightly and publish tag to docker hub steps (#6399) 2020-06-30 20:12:27 +01:00
Dan Newton
8cd2d4891a
Merge pull request #6416 from corda/dan/CORDA-3722-session-rollbacks-backport-4.4
CORDA-3722 session rollbacks - backport
2020-06-30 13:35:14 +01:00
LankyDan
d35e8ba526 CORDA-3722 Add imports in RestrictedEntityManager
Needed after backporting a change
2020-06-30 11:54:16 +01:00
Dan Newton
efd633c7b9 CORDA-3722 withEntityManager can rollback its session (#6187)
* CORDA-3722 withEntityManager can rollback its session

Improve the handling of database transactions when using
`withEntityManager` inside a flow.

Extra changes have been included to improve the safety and
correctness of Corda around handling database transactions.

This focuses on allowing flows to catch errors that occur inside an
entity manager and handle them accordingly.

Errors can be caught in two places:

- Inside `withEntityManager`
- Outside `withEntityManager`

Further changes have been included to ensure that transactions are
rolled back correctly.

Errors caught inside `withEntityManager` require the flow to manually
`flush` the current session (the entity manager's individual session).
By manually flushing the session, a `try-catch` block can be placed
around the `flush` call, allowing possible exceptions to be caught.

Once an error is thrown from a call to `flush`, it is no longer possible
to use the same entity manager to trigger any database operations. The
only possible option is to rollback the changes from that session.
The flow can continue executing updates within the same session but they
will never be committed. What happens in this situation should be handled
by the flow. Explicitly restricting the scenario requires a lot of effort
and code. Instead, we should rely on the developer to control complex
workflows.

To continue updating the database after an error like this occurs, a new
`withEntityManager` block should be used (after catching the previous
error).

Exceptions can be caught around `withEntityManager` blocks. This allows
errors to be handled in the same way as stated above, except the need to
manually `flush` the session is removed. `withEntityManager` will
automatically `flush` a session if it has not been marked for rollback
due to an earlier error.

A `try-catch` can then be placed around the whole of the
`withEntityManager` block, allowing the error to be caught while not
committing any changes to the underlying database transaction.

To make `withEntityManager` blocks work like mini database transactions,
save points have been utilised. A new savepoint is created when opening
a `withEntityManager` block (along with a new session). It is then used
as a reference point to rollback to if the session errors and needs to
roll back. The savepoint is then released (independently from
completing successfully or failing).

Using save points means, that either all the statements inside the
entity manager are executed, or none of them are.

- A new session is created every time an entity manager is requested,
but this does not replace the flow's main underlying database session.
- `CordaPersistence.transaction` can now determine whether it needs
to execute its extra error handling code. This is needed to allow errors
escape `withEntityManager` blocks while allowing some of our exception
handling around subscribers (in `NodeVaultService`) to continue to work.
2020-06-30 11:54:16 +01:00
Dan Newton
f6b5737277
ENT-5196 handle errors during flow initialisation (#6378)
## Summary

This change deals with multiple issues:

* Errors that occur during flow initialisation.

* Errors that occur when handling the outcome of an existing flow error.

* Failures to rollback and close a database transaction when an error
occurs in `TransitionExecutorImpl`.

* Removal of create and commit transaction actions around retrying a flow.

## Errors that occur during flow initialisation

Flow initialisation has been moved into the try/catch that exists inside
`FlowStateMachineImpl.run`. This means if an error is thrown all the way
out of `initialiseFlow` (which should rarely happen) it will be caught 
and move into a flow's standard error handling path. The flow should 
then properly terminate.

`Event.Error` was changed to make the choice to rollback be optional. 
Errors during flow initialisation cause the flow to not have a open 
database transaction. Therefore there is no need to rollback.

## Errors that occur when handling the outcome of an existing flow error

When an error occurs a flow goes to the flow hospital and is given an 
outcome event to address the original error. If the transition that was 
processing the error outcome event (`StartErrorPropagation` and
`RetryFlowFromSafePoint`) has an error then the flow aborts and
nothing happens. This means that the flow is left in a runnable state.

To resolve this, we now retry the original error outcome event whenever 
another error occurs doing so.

This is done by adding a new staff member that looks for 
`ErrorStateTransitionException` thrown in the error code path of 
`TransitionExecutorImpl`. It then takes the last outcome for that flow 
and schedules it to run again. This scheduling runs with a backoff.

This means that a flow will continually retry the original error outcome
event until it completes it successfully.

## Failures to rollback and close a database transaction when an error occurs in `TransitionExecutorImpl`
   
Rolling back and closing the database transaction inside of 
`TransitionExecutorImpl` is now done inside individual try/catch blocks
as this should not prevent the flow from continuing.

## Removal of create and commit transaction actions around retrying a flow

The database commit that occurs after retrying a flow can fail which 
required some custom code just for that event to prevent inconsistent 
behaviour. The transaction was only needed for reading checkpoints from 
the database, therefore the transaction was moved into 
`retryFlowFromSafePoint` instead and the commit removed.

If we need to commit data inside of `retryFlowFromSafePoint` in the 
future, a commit should be added directly to `retryFlowFromSafePoint`. 
The commit should occur before the flow is started on a new fiber.
2020-06-30 11:50:42 +01:00
Tamas Veingartner
18cd24c2b4
NOTICK Ignore pagination large volume test as its completion is environment dependent and might cause issues in slower environments (#6420) 2020-06-30 10:12:31 +01:00