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

Transferprocess starts multiple times when transferring huge data #3563

Closed
Jens011203 opened this issue Oct 24, 2023 · 2 comments · Fixed by #3565
Closed

Transferprocess starts multiple times when transferring huge data #3563

Jens011203 opened this issue Oct 24, 2023 · 2 comments · Fixed by #3565
Assignees
Labels
bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification

Comments

@Jens011203
Copy link

Bug Report

During testing to find out the amount of data I can transfer via the HTTP dataplane, I discovered that when transferring 1Gb, 4-6 Gb was received on consumer side.

Describe the Bug

When the data is too large and hence the transfer method takes a very long time, the process remains in the RECEIVED state when the performLogic is run again in the StateMachineManager.

private boolean processReceived(DataFlow dataFlow) {
        var request = dataFlow.toRequest();
        var transferService = transferServiceRegistry.resolveTransferService(request);

        if (transferService == null) {
            dataFlow.transitToFailed("No transferService available for DataFlow " + dataFlow.getId());
            update(dataFlow);
            return true;
        }

        return entityRetryProcessFactory.doAsyncProcess(dataFlow, () -> transferService.transfer(request))
                .entityRetrieve(id -> store.findById(id))
                .onSuccess((f, r) -> {
                    if (r.succeeded()) {
                        f.transitToCompleted();
                    } else {
                        f.transitToFailed(r.getFailureDetail());
                    }
                    update(f);
                })
                .onFailure((f, t) -> {
                    f.transitToReceived();
                    update(f);
                })
                .onRetryExhausted((f, t) -> {
                    f.transitToFailed(t.getMessage());
                    update(f);
                })
                .execute("start data flow");
    }
   @Override
    protected StateMachineManager.Builder configureStateMachineManager(StateMachineManager.Builder builder) {
        return builder
                .processor(processDataFlowInState(RECEIVED, this::processReceived))
                .processor(processDataFlowInState(COMPLETED, this::processCompleted))
                .processor(processDataFlowInState(FAILED, this::processFailed));
    }

    private Runnable loop() {
        return () -> {
            if (active.get()) {
                performLogic();
            }
        };
    }

    private void performLogic() {
        try {
            var processed = processors.stream()
                    .mapToLong(Processor::process)
                    .sum();

            waitStrategy.success();

            var delay = processed == 0 ? waitStrategy.waitForMillis() : 0;

            scheduleNextIterationIn(delay);
        } catch (Error e) {
            active.set(false);
            monitor.severe(format("StateMachineManager [%s] unrecoverable error", name), e);
        } catch (Throwable e) {
            monitor.severe(format("StateMachineManager [%s] error caught", name), e);
            scheduleNextIterationIn(waitStrategy.retryInMillis());
        }
    }

Expected Behavior

The same transferprocess should'nt be startet multiple times.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Transfer 1Gb over the http-data-plane
@github-actions
Copy link

Thanks for your contribution 🔥 We will take a look asap 🚀

@ndr-brt ndr-brt added bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification labels Oct 25, 2023
@ndr-brt
Copy link
Member

ndr-brt commented Oct 25, 2023

I also found out some issues with this design, I think this should be fixed by changing the state from RECEIVED to STARTED so then the data flow won't get picked up by the state machine again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants