google-nomulus/java/google/registry/flows
nickfelt 01698059f6 Fix flow double-init bug by removing @FlowScope on provideFlow()
See [] for details, but basically, @FlowScope causes the Flow instance produced by flowProvider.get() in FlowRunner to be the same each time it's called, which leads to the instance being re-used when a transactional retry (e.g. for a ConcurrentModificationException) causes a flow to be attempted more than once.  Flow is not meant to be re-used and certain flows fail at runtime when this happens, so the effect is that a CME now aborts most EPP requests, which is bad.

This is a bit of a hacky fix; finding a better one is tracked in []

== TESTING ==
This is very hard to test because there isn't really a clean way to trigger a CME from within a flow's execution without hardcoding in assumptions about what a given flow is doing when it runs, and we can't easily supply a custom Flow for testing while also exercising the Flow daggerization process (since this bug only appears due to the specific way that dagger constructs the Provider<Flow>).  Ideally a fix would improve the testability here as well.

For now, I've manually tested this change by pasting code into FlowRunner that explicitly throws a ConcurrentModificationException after running the flow (similar to DryRunException), but only on the first transaction attempt.  With @FlowScope on provideFlow(), this change reproduces the UnsupportedOperationException issue in many tests; once it's removed (i.e. with this CL submitted) the problem goes away.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126226066
2016-07-01 13:36:15 -04:00
..
async Delete the useless MapreduceAction interface 2016-05-18 13:09:40 -04:00
contact Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
domain Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
host Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
picker Simplify an exception's constructor. 2016-06-27 16:12:00 -04:00
poll Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
session Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
soy Turn CheckApiAction into a standard-ish epp endpoint 2016-06-27 16:22:12 -04:00
BUILD Fix soy open source build error 2016-06-27 16:33:28 -04:00
CheckApiAction.java Turn CheckApiAction into a standard-ish epp endpoint 2016-06-27 16:22:12 -04:00
EppConsoleAction.java Break SessionSource out of SessionMetadata and rename it EppRequestSource. 2016-06-27 16:19:21 -04:00
EppController.java Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
EppException.java Simplify an exception's constructor. 2016-06-27 16:12:00 -04:00
EppRequestHandler.java Turn CheckApiAction into a standard-ish epp endpoint 2016-06-27 16:22:12 -04:00
EppRequestSource.java Break SessionSource out of SessionMetadata and rename it EppRequestSource. 2016-06-27 16:19:21 -04:00
EppTlsAction.java Break SessionSource out of SessionMetadata and rename it EppRequestSource. 2016-06-27 16:19:21 -04:00
EppToolAction.java Break SessionSource out of SessionMetadata and rename it EppRequestSource. 2016-06-27 16:19:21 -04:00
EppXmlTransformer.java Fix generics in EppXmlTransformer.unmarshal to not be only on the return type. 2016-06-27 15:55:03 -04:00
Flow.java Inject two fields into flows. 2016-06-27 16:27:57 -04:00
FlowComponent.java Fix flow double-init bug by removing @FlowScope on provideFlow() 2016-07-01 13:36:15 -04:00
FlowModule.java Inject flows with a nested ternary rather than a map 2016-06-27 16:29:19 -04:00
FlowRunner.java Add new JSON logging to FlowRunner for EPP activity reporting 2016-06-27 16:45:55 -04:00
FlowScope.java Dagger, meet Flows. Flows, meet Dagger. 2016-06-27 16:26:29 -04:00
GaeUserCredentials.java Refactor SessionMetadata and TransportCredentials toString() methods 2016-06-27 16:43:12 -04:00
HttpSessionMetadata.java Refactor SessionMetadata and TransportCredentials toString() methods 2016-06-27 16:43:12 -04:00
LoggedInFlow.java Decouple superuser from SessionMetadata 2016-06-27 16:17:57 -04:00
OwnedResourceMutateFlow.java Decouple superuser from SessionMetadata 2016-06-27 16:17:57 -04:00
OwnedResourceMutatePendingTransferFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
PasswordOnlyTransportCredentials.java Refactor SessionMetadata and TransportCredentials toString() methods 2016-06-27 16:43:12 -04:00
ResourceAsyncDeleteFlow.java Remove nearly all uses of ReferenceUnion 2016-05-16 16:36:25 -04:00
ResourceCheckFlow.java Rename Response in the epp model to EppResponse 2016-06-14 16:30:26 -04:00
ResourceCreateFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceCreateOrMutateFlow.java Inject two fields into flows. 2016-06-27 16:27:57 -04:00
ResourceDeleteFlow.java Rename Response in the epp model to EppResponse 2016-06-14 16:30:26 -04:00
ResourceFlow.java Decouple superuser from SessionMetadata 2016-06-27 16:17:57 -04:00
ResourceFlowUtils.java Make javadoc <p> style guide compliant 2016-05-18 13:09:01 -04:00
ResourceInfoFlow.java Rename Response in the epp model to EppResponse 2016-06-14 16:30:26 -04:00
ResourceMutateFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceMutatePendingTransferFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceQueryFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceSyncDeleteFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceTransferApproveFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceTransferCancelFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceTransferFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceTransferQueryFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceTransferRejectFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
ResourceTransferRequestFlow.java Rename Response in the epp model to EppResponse 2016-06-14 16:30:26 -04:00
ResourceUpdateFlow.java Decouple superuser from SessionMetadata 2016-06-27 16:17:57 -04:00
SessionMetadata.java Refactor SessionMetadata and TransportCredentials toString() methods 2016-06-27 16:43:12 -04:00
SingleResourceFlow.java Rename Java packages to use the .google TLD 2016-05-13 20:04:42 -04:00
StatelessRequestSessionMetadata.java Fix import to use canonical Preconditions package 2016-07-01 13:30:58 -04:00
TlsCredentials.java Refactor SessionMetadata and TransportCredentials toString() methods 2016-06-27 16:43:12 -04:00
TransactionalFlow.java Make javadoc <p> style guide compliant 2016-05-18 13:09:01 -04:00
TransportCredentials.java Decouple SessionMetadata and TransportCredentials 2016-06-27 16:14:57 -04:00