Commit Graph

8197 Commits

Author SHA1 Message Date
LankyDan
44206a0bea CORDA-3194 Update flow hospital docs, tidy comment and make exception public 2019-11-01 11:48:07 +00:00
Dan Newton
f4e9b9d5d2 CORDA-3194 Stop killed flows from re-entering hospital (#2664)
* CORDA-3194 Do not allow killed flows back into the hospital

This change has been made to prevent killed flows from being added back
to the hospital after being forcibly removed by `killFlow`. Not doing so,
could leave references to a flow inside of the hospital, which is not
the correct behaviour.

`killFlow` now sets a flow's `StatemachineState.isRemoved` to true.

This check is then used in `StaffedFlowHospital` and the
`DumpHistoryOnErrorInterceptor`.

* CORDA-3194 Log different message for transition error due to killed flow

When a flow is killed, its checkpoint is deleted. Currently, the
statemachine will still try a process the next event even if it has
been killed. This can lead to an error when trying to update the
deleted checkpoint. The exception thrown from this is logged out.

An if statement has been added to log a different message at debug level
if it is due to an update error for a killed flow. This is done to not
alarm node operators of the exception.
2019-11-01 11:48:07 +00:00
Dan Newton
3b3dbd7352 CORDA-3194 Add extra test cases to StatemachineErrorHandlingTest (#2651)
* CORDA-3194 - Add `ReceiveFinalityFlow` byteman tests

* CORDA-3194 Tidy up `StatemachineErrorHandlingTest`
2019-11-01 11:48:07 +00:00
Dan Newton
a591c8e25b CORDA-3194 Relax duplicate insert flow hospital handling (#2643)
* CORDA-3194 Relax duplicate insert flow hospital handling

Revert a previous change to now make the duplicate insert staff member to
give a diagnosis of discharge or not my speciality (previously gave
terminal).

This is to prevent duplicate insert handling from overriding finality
flow error handling.
2019-11-01 11:48:07 +00:00
kyriathar
877ce5587f CORDA-3196 warning at intervals when flows waiting in flow hospital (#2636)
* added the warning as a TimerTask at StaffedFlowHospital#delayedDischargeTimer

* moved the scheduling of the warning task at StaffedFlowHospital#init block. That way we ensure that the task will be scheduled only once at StaffedFlowHospital initialization.

* Corrected overnight observation warning task's logging message. Changed StaffedFlowHospital#delayedDischargeTimer to the more generic StaffedFlowHospital#hospitalJobTimer since it now schedules delayed discharges tasks as well the overnight observation warning task. Removed this from property reference

* switching to fun timerTask for the instantiation of anonymous TimerTask classes

* Correct condition to log patients who are currently in the hospital, whose last record in their medical records is Outcome.OVERNIGHT_OBSERVATION. Extended logging to include treatableSessionInits staying in the hospital

* Add not empty check for patientsUnderOvernightObservation. Correct strings.
2019-11-01 11:48:07 +00:00
Dan Newton
ef01a99737 CORDA-3194 Failure during flow retry forces the flow into overnight observation (#2640)
When a flow fails to retry, it should be kept in for overnight observation and aborted.

In the future, it might be possible to retry flows again that failed during their retry, but for now keeping for observation and aborting is satisfactory.

* CORDA-3194 Remove hospitalised flows from `HospitalisingInterceptor`

Small refactor to remove some of the hospital logic out of the
`HospitalisingInterceptor` and into the `StaffedFlowHospital`.

Add some comments to help clarify the purpose of the two maps inside
of the hospital.

* CORDA-3194 When a flow fails to retry force it into observation

When a flow fails to retry, it should be kept in for overnight
observation and aborted.

In the future, it might be possible to retry flows again that failed
during their retry, but for now keeping for observation and aborting is
satisfactory.

* CORDA-3194 Test for database commit failure when retrying a flow

Failing during the database commit failure that occurs after the retry
flow action does not stop the flow from actually retrying. This test
confirms this functionality.

The retried flow gets scheduled as part of the retry action. The failure
in the commit action does not prevent this since it has already been
scheduled.
2019-11-01 11:48:07 +00:00
Dan Newton
268d129838 CORDA-3194 Replay start flow events when responding flow fails initial checkpoint commit (#2601)
* CORDA-3194 Replay start flow events when responding flow fails initial checkpoint commit

Logic has already been added to recover from initial checkpoint commit
failures on the initiating flow side but this did not suffice for
the same failure occurring on the responding flow's side.

The same idea has been added to resolve the responding flow's issue.

`ExternalMessageEvent` now has a `flowId` that is maintained on the
event. Messages can then be replayed to start/restart the flow, while
the event provides the flow id to each flow start.

Each `ExternalMessageEvent` implementation generates a random `flowId`
when constructed.

Events are stored in Artemis. This allows the solution to recover across
node restarts as the events will be pulled from artemis again when
restarting.

In the future `flowId`s will probably moved off of the events and
generated purely on the responding flow's node.

* CORDA-3194 Add test to verify that errors removing a responding flow are recoverable
2019-11-01 11:48:07 +00:00
Christian Sailer
1f71b071aa CORDA-3217 and CORDA-3195 Various bits arond SQL exceptions and flow hospital (#2605)
* Unwrap rx.OnErrorNotImplementedException so the hospital can handle the cause appropriately

* Add db failure cordapp

* Renamed folders to avoid ambiguity in gradle

* Add integration test for exception hospitalisation when thrown from an RX observable.

* Make the test slightly cleaner

* Fix the schema to actually match the requirements for my custom state. Thanks a bunch, H2.

* Switch test to use SqlException base class.

* Schedule error event if we detect that a commit or db flush has thrown (forcing the flow to error even if customer code then goes ahead to swallow the exception)

* Revert change to schedule extra error

* Add more tests for edge case with DB exceptions, changed CorDapp to suppor this an hook in the flow hospital

* Warning about unsubscribe
Check state transitioned from clean to error for hospital admission.

* Match the test to our actual expectations

* Revert "Revert change to schedule extra error"

This reverts commit 43d47937

* Prevent suppression of errors arising in `transaction()` and `jdbcConnection()`

* Test for SqlException caught trying to escape from recordTransaction and suppressed outside being intercepted.

* More tests for various error/catch combinations

* Clean up and comments

* Code reformat

* Fix test compilation
2019-11-01 11:48:07 +00:00
Dan Newton
9b169df2b8 CORDA-3194 Wrap state transition exceptions and add flow hospital error handling for them (#2542)
Wrap exceptions that occur in state machine transitions with a custom exception type which is
then handled inside of the flow hospital. As part of this change, a number of side negative side
effects have been addressed.

General summary:

- `StateTransitionException` wraps exceptions caught in `TransitionExecutorImpl`
- `StateTransitionExceptions` are handled in the flow hospital, retried 3 times and then kept in
    for observation if errors persist (assuming conditions below are false)
- Exceptions that occur in `FlowAsyncOperation` events are wrapped in
  `AsyncOperationTransitionException` and ignored by the flow hospital transition staff member
- `InterruptException`s are given a `TERMINAL` diagnosis by the flow hospital transition staff
   member (can occur due to `killFlow`)
- Allow flows which have not persisted their original checkpoint to still retry by replaying their
   start flow messages
- Swallow exceptions in `AcknowledgeMessages` actions

Detailed summary:

* CORDA-3194 Add state machine transition error handling to flow hospital

Wrap exceptions that are caught in `TransitionExecutorImpl` (coming from
new errors) with `StateTransitionException`. This exception is then
handled explicitly by the flow hospital.

Add `TransitionErrorGeneralPractitioner` to `StaffedFlowHospital`. This
staff member handles errors that mention `StateTransitionException`.
Errors are retried and then kept in the hospital if the errors persist.

* CORDA-3194 Remove a fiber from the `hospitalisedFlows` if its previous state was clean

If the fiber's previous state was clean then remove it from
`HospitalisingInterceptor.hospitalisedFlows`. This allows flows that are
being retried to clean themselves. Doing this allows them to re-enter
the flow hospital after executing the fiber's transition (if an error
occurs).

This is important for retrying a flow that has errored during a
transition.

* CORDA-3194 Set `isAnyCheckpointPersisted` to true when retrying a flow

Added to prevent a single flow from creating multiple checkpoints when
a failure occurs during `Action.AcknowledgeMessages`.

More specifically, to `isAnyCheckpointPersisted` is false when retrying
the flow, even though a checkpoint has actually been saved. Due to this
a brand new flow is started with a new flow id (causing duplication).

Setting `isAnyCheckpointPersisted` to true specifically when retrying a
flow resolves this issue.

* CORDA-3194 Add Byteman test to verify transition error handling

Add `StatemachineErrorHandlingTest` to verify transition error handling.

Byteman allows exceptions to be injected at certain points in the code's
execution. Therefore exceptions can be thrown when needed inside of the
state machine.

The current tests check errors in events:
- `InitiateFlow`
- `AcknowledgeMessages`

* CORDA-3194 Swallow all exceptions in `ActionExecutorImpl.executeAcknowledgeMessages`

Swallow the exceptions that occur in the `DeduplicationHandler`s when
inside of `ActionExecutorImpl.executeAcknowledgeMessages`.

The side effects of the failures that can happen in the handlers are
not serious enough to put the transition into a failure state.
Therefore they are now caught. This allows the transition to continue
as normal, even if an error occurs in one any of the handlers.

* CORDA-3194 Wrap unexpected exceptions thrown in async operation transitions

Exceptions thrown inside of `FlowAsyncOperation.execute` implementations
that are not returned as part of the future, are caught, wrapped and
rethrown. This prevents unexpected exceptions thrown by (most likely)
user code from being handled by the hospital by the transition
staff member.

This handling might change moving forward, but it allows the async
operation to continue working as it was before transition error handling
was added.

* CORDA-3194 Verify that errors inside of `AcknowledgeMessages` work as expected

Update `StatemachineErrorHandlingTest` to correctly test errors that
occur when executing the `AcknowledgeMessages` action.

* CORDA-3194 Retry flows that failed to persist their original checkpoint

Allow a flow that failed when creating their original checkpoint (for
example - failing to commit the db transaction) to retry.

The flow will create a brand new checkpoint (as the original did not
saved).

This required adding `flowId` to `ExternalStartFlowEvent` to allow the
event to keep a record of the flow's id. When the flow is retried, the
events are replayed which trigger a flow to be started that has the
id stored in the event.

To allow this change, code was removed from `retryFlowFromSafePoint` to
allow the function to continue, even if no checkpoint matches the passed
in flow id.

* CORDA-3194 Correct `FlowFrameworkTests` test due to error handling

Test assumed that errors in transitions are not retried, this has now
been updated so the test passes with the flow succeeding after an
exception is thrown.

* CORDA-3194 Remove unneeded import

* CORDA-3194 Make the state transition exceptions extend `CordaException`

`StateTransitionException` and `AsyncOperationTransitionException` now
extend `CordaException` instead of `Exception`.

* CORDA-3194 Improve log messages

* CORDA-3194 Remove unneeded code in `HospitalisingInterceptor`

Due to a previous change, a section of code that removes a flow id
from the `hospitalisedFlows` map is no longer required. This code has
been removed.

* CORDA-3194 Constraint violations are given `TERMINAL` diagnosis

Add `Diagnosis.TERMINAL` to `StaffedFlowHospital` to allow an error
to be ignored and left to die a quick and painful death.

`StateTransitionException` changed so it does not cause serialisation
errors when propagated from a flow.

* CORDA-3194 `InterruptedExceptions` are given `TERMINAL` diagnosis
2019-11-01 11:48:07 +00:00
Christian Sailer
938828b52f CORDA-3195 Default behaviour of FlowHospital (WIP) (#2520)
* Add GP to flow hospital, and start working on a list of things the GP knows to be incurable.

* Only hospitalise SQL and Persistence Exceptions (let's see if that is enough?), also rename to DatabaseDentist.

* Disabled hospitalisation of SQL exceptions in flow retry tests

* Fix RPC exception handling test by not using PersistenceException

* Ignore flaky integration test

* Code review: Rename staff member and add testing annotation

* Revert compiler.xml
2019-11-01 11:48:07 +00:00
snedamle
93ff072812 adding one point to whitelist contract constraints migration - signed… (#5568)
* adding one point to whitelist contract constraints migration - signed CorDapp JAR must be registered with the CZ network operator

* 1. Removing later releases section
2. Changing 4.0 to 4.3

* Changing 4.3 to |corda_version|
2019-11-01 10:49:04 +00:00
Andrius Dagys
d033fceeef CORDA-3365: Reintroduce dependency to fix BFT-Smart notary (#5640)
The commons-codec:1.10 library was removed due to a security vulnerability,
but in commons-codec:1.13 it appears to have been fixed.
2019-11-01 09:05:12 +00:00
James Higgs
e0701231ac [DOCS] Add rows for new database tables in node-database.rst (#5654) 2019-10-31 17:57:52 +00:00
stefano
7a9ee89ded modify watcher to watch jobs rather than pods 2019-10-31 16:51:33 +00:00
stefano
bd9d8dbdbd promote failure to delete to error log level 2019-10-31 15:58:05 +00:00
stefano
547e6d9edd use jobs to preallocate nodes instead of Pods as they support auto delete 2019-10-31 15:57:03 +00:00
thorgilman
99a571bd9e Fix reference to deprecated UAT on-boarding site (#5647)
Updated the UAT on-boarding doc to so that it no longer references depreciated UAT on-boarding site and instead links to the Corda Network participation page.
2019-10-31 15:50:47 +00:00
Dimos Raptis
79c22bd77a Constrain the cordapps loaded from driver tests to the minimum required (#5653) 2019-10-31 11:26:05 +00:00
Chris Rankin
2895283500 CORDA-3388: Restore mapping of 'java.lang.Void -> void' (#5650) 2019-10-30 17:47:13 +00:00
Chris Rankin
346410a2e1 CORDA-3327: Fix API scanning for Java 11. (#5645) 2019-10-30 17:24:34 +00:00
Tudor Malene
5cdf7f2b2f CORDA-3370 Remove Network visualiser reference 2019-10-30 16:45:33 +00:00
dependabot[bot]
b7273f931e Bump pillow from 5.1.0 to 6.2.0 in /docs (#5632)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 5.1.0 to 6.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/5.1.0...6.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-30 16:37:59 +00:00
Tudor Malene
e32f1ca4f2 CORDA-3369 fix samples readme 2019-10-30 16:30:18 +00:00
Stefano Franz
da61b9ed2a
Merge pull request #5646 from corda/my_merge_branch
Merge OS 4.3 -> OS 4.4
2019-10-30 15:46:33 +00:00
Stefan Iliev
03ab258fc2 Revert "CORDA-3307 - add support for environment variables in linux (#5523)" (#5643)
This reverts commit c882b221a5.
2019-10-29 17:55:58 +00:00
stefano
8fd3e867f3 Merge remote-tracking branch 'origin/release/os/4.3' into my_merge_branch 2019-10-29 16:24:08 +00:00
Razvan Codreanu
d5462a2afe Re enabling persistent volume claims (#5628)
* TM-68 reenabling persistent volume claims using azure files

* TM-68 jenkins stackstracee

* TM-68 removing duplicate volume

* TM-68 pushing storage class yaml file

* TM-68 writing all results to the new persistent volume

* TM-68 fix wrong directory

* TM-68 fix wrong directory

* reapply lost merge commit

* investigate missing POD from test results

* more investigations around pods not executing their tests

* make Pod command line more strict with regards to sub command failure

* make logs an artifact within jenkins

* tidy up command line
2019-10-29 16:23:22 +00:00
Anthony Keenan
8a12224b29
NOTICK: Switch on ignore enums rule in detekt (#5641) 2019-10-29 14:46:25 +00:00
szymonsztuka
ac633bef2f CORDA-3348 Migration from Corda 3.x to 4.x for PostgreSQL require a manual workaround - fix by probing for lowercase table as well to detect if this is an existing database (#5625) 2019-10-29 11:22:52 +00:00
Nick Dunstone
4c7fbbc31b SecureRandomHash for internal shell password (#5638) 2019-10-28 15:56:11 +00:00
Ed Prosser
b4d16399a8 streamlining getting started docs
Signed-off-by: Ed Prosser <edward.prosser@r3.com>
2019-10-28 11:49:19 +00:00
Stefano Franz
f9890a5359
PreAllocate pod resources during image build phase (#5587)
* use zulu for jdk
add some parallel groups

* port kubesTest to Java
remove asterix from tests listed by ListTests, instead add after allocation

* attempt to setup unit test builds with correct github integrations

# Conflicts:
#	.ci/dev/unit/Jenkinsfile

* fix issue with github context

* add credentials block

* start pre-allocating pods for builds

* test

* add blocks for reporting build stages

* add logic to preallocate pods during image building

* tidy up Jenkinsfile for unit tests

* add magic command line flag to enable preallocation of pods

* make docker tag deterministic

* fix issue concatenating docker tag inputs

* add build type specific Jenkinsfile

* try new preallocation approach

* make pre-allocation prefix group specific

* force deAllocator to wait for pods to be actually deleted

* revert jenkinsfiles in .ci

* use smarter waiting logic to address review comments

* add --stacktrace to builds to help debugging

* fix issue with closed stream

* add some logging around preallocation

* tidy up by refactoring (de)allocate task generation into method

* change default from 20 pods to 5 pods

* fix issue where docker tag was unstable between building and running tests

* more documentation

* add some infrastructure around setting the log level for a given build

* change preallocation pod duration to 5min

* see if fast enough if using combined unit and integration tests

* disable unit tests

* print out test summaries

* try and make the kubes client a per-use object, rather than a long lived object. This is step one of making GKE use possible

* add log line about what command is executed in the pod
2019-10-28 11:48:04 +00:00
Chris Rankin
bcba66f95d CORDA-2963: Update the Deterministic Java API artifacts. (#5637)
* CORDA-2963: Restore FileChannel to deterministic-rt but still remove it from the API artifact.

* CORDA-2963: Restore stub ObjectStream classes to deterministic-rt but still remove them from the API artifact.

* CORDA-2963: Add currency.data to deterministic-rt.jar as a resource.

* CORDA-2963: Add tzdb.dat to deterministic-rt.jar as a resource.

* CORDA-3326: Restore supported java.util.concurrent.* classes to the API artifact.
2019-10-25 10:39:56 +01:00
Anthony Keenan
6e43bc1db6
CORDA-3302: Align OS + Ent SchemaMigration parameters (#5622)
* Rename SchemaMigrationTest and make ourName parameter nullable to remove enterprise conflicts

* Fix detekt baseline

* Further alignment

* Update detekt
2019-10-24 18:54:35 +01:00
kyriathar
e2836b1106 CORDA-3279 Change single quotes to double quotes fixes node's shutdown (#5611)
A ConfigException$Parse would be thrown at CordaCaplet#parseConfigFile.

com.typesafe.config.ConfigFactory needs ':' to be included in a double quoted and not in a single quoted string.
2019-10-23 10:01:24 +01:00
Christian Sailer
df8cc7282f CORDA-3360 Add nodeInfo permissions to web user 2019-10-23 09:58:59 +01:00
Andrius Dagys
6493ffefef DOCS: Update notary data visibility page 2019-10-22 16:32:50 +01:00
Ryan Fowler
8e541cb732 CORDA-3358: Add capsule-friendly argument to docs 2019-10-22 16:14:35 +01:00
Anthony Keenan
444881d536
Merge pull request #5624 from corda/anthony/merge-20191021
OS 4.3->OS 4.4 Merge 21-10-2019
2019-10-22 11:32:38 +01:00
szymonsztuka
b524c6368b CORDA-3335 Corda Shell flow kill - better warning for misformatted flow ID (#5601)
* CORDA-3081 warn that flow ID passed to flow kill is malformed as due to JDK8 doesn't fully validate it (JDK8 bug https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8159339)

* CORDA-3335 Corda Shell flow kill - better warning for misformatted flow ID - exit earlier and don't RPC to node, refactoring for detekt
2019-10-22 11:32:17 +01:00
Ryan Fowler
5da114caa3 CORDA-3281: Drop some errors to warnings and clean up logic around (#5605)
shell "gracefulShutdown" command.
2019-10-22 11:02:04 +01:00
Dimos Raptis
61cdfa5b26 [CORDA-3341] - Add missing liquibase script for hibernate test (#5623) 2019-10-22 09:52:37 +01:00
Stefano Franz
d693a9c1ce
TM-65 re-add local port availability check (#5618)
* re-add local port availability check

* attempt to fix issue with port allocator

* ensure the serversocket is closed
2019-10-21 16:17:17 +01:00
Chris Rankin
51ffd3d032 CORDA-3346: Replace JitPack dependency on JediTerm with 2.22 from Maven Central. (#5619) 2019-10-21 15:16:36 +01:00
Jonathan Locke
2ea7e6ccae
CORDA-3346: Remove the JitPack repository from Corda (#5620)
CORDA-3346: Remove the JitPack repository from Corda (#5620)
2019-10-21 15:13:42 +01:00
Anthony Keenan
0a194cfb51 Merge branch 'release/os/4.3' into release/os/4.4
# Conflicts:
#	docs/source/docker-image.rst
2019-10-21 13:44:32 +01:00
Anthony Keenan
b9a3b3a871
CORDA-3336: Remove log4j plugins to stop errors in config generator (#5617) 2019-10-21 13:31:09 +01:00
Dimos Raptis
bb7c06fa45 [CORDA-3342] - Show proper error message and adjust indentation in shell (#5612) 2019-10-21 13:21:12 +01:00
Chris Rankin
971eb56a98 CORDA-3346: Remove the JitPack repository from Corda. 2019-10-21 13:15:03 +01:00
Stefan Iliev
c882b221a5 CORDA-3307 - add support for environment variables in linux (#5523)
* Added a new way for environment variables to be loaded, which allows for underscore based separation.

* Moved test to its own kotlin file.

* Added case insensitivity support.

* The corda. prefix is now case insensitive too.

* Removed unused variable.

* Added env variables support for driverDSL. Shadowing corda. properties raises an exception.

* Driver api stability fix.

* Changed type of cordapps param to reflect the real one, rather than what IntelliJ auto completed.

* Some detekt issue fixes. Spread operator removed, baselined api stability constructors and buggy line.

* Fixed misspelled variable.

* Reverted unintentional changes.

* Added suppress instead of changing baseline.

* Reworked logic to handle previously defined CORDA_ starting properties and handle accordingly. Fixed a bug where wrong class was used for reflection walking.

* Fix for detekt issues.

* Changed message to a more understandable one.

* Changelog + doc note, console error grammar.

* Changes according to PR review.
2019-10-21 12:01:14 +01:00