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

ticket-1566 Fixed mutually dependent stuck delays of M2S and S2S parts of transfer loop #1568

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/comprehensive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,21 @@ jobs:
echo ------------ lscpu
lscpu || true

- name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps
- name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl
run: |
sudo apt-get update
sudo apt-get install libc6 net-tools btrfs-progs zip unzip
sudo apt-get install bash
sudo apt-get install procps
sudo apt-get install curl

- name: INIT - install docker with compose
- name: INIT - install docker
run: |
echo " --------------------------- remove old packages ------------------------------------------------------------------------------------------------------ "
sudo apt-get remove docker* containerd* || true
echo " --------------------------- install containerd.io ---------------------------------------------------------------------------------------------------- "
sudo apt-get install containerd.io
echo " --------------------------- install docker.io -------------------------------------------------------------------------------------------------------- "
echo " --------------------------- install docker-compose --------------------------------------------------------------------------------------------------- "
sudo apt-get install docker-compose
curl -fsSL https://get.docker.com -o install-docker.sh
sudo sh install-docker.sh
docker --version
docker-compose --version

- name: INIT - reconfigure docker and restart its daemon
run: |
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/container-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,21 @@ jobs:
echo ------------ lscpu
lscpu || true

- name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps
- name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl
run: |
sudo apt-get update
sudo apt-get install libc6 net-tools btrfs-progs zip unzip
sudo apt-get install bash
sudo apt-get install procps
sudo apt-get install curl

- name: INIT - install docker with compose
- name: INIT - install docker
run: |
echo " --------------------------- remove old packages ------------------------------------------------------------------------------------------------------ "
sudo apt-get remove docker* containerd* || true
echo " --------------------------- install containerd.io ---------------------------------------------------------------------------------------------------- "
sudo apt-get install containerd.io
echo " --------------------------- install docker.io -------------------------------------------------------------------------------------------------------- "
echo " --------------------------- install docker-compose --------------------------------------------------------------------------------------------------- "
sudo apt-get install docker-compose
curl -fsSL https://get.docker.com -o install-docker.sh
sudo sh install-docker.sh
docker --version
docker-compose --version

- name: INIT - reconfigure docker and restart its daemon
run: |
Expand Down
78 changes: 56 additions & 22 deletions agent/loop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -408,39 +408,73 @@ async function singleTransferLoopPartS2S( optsLoop, strLogPrefix ) {
return b3;
}

function printLoopPartSkippedWarning( strLoopPartName ) {
if( log.verboseGet() >= log.verboseReversed().warning ) {
log.write( strLogPrefix + cc.warning( "Skipped " ) + cc.notice( strLoopPartName ) +
cc.warning( " transfer loop part due to other single " +
"transfer loop is in progress right now" ) + "\n" );
}
}

export async function singleTransferLoop( optsLoop ) {
const imaState = state.get();
const strLogPrefix = cc.attention( "Single Loop in " ) +
threadInfo.threadDescription() + cc.debug( ":" ) + " ";
try {
if( log.verboseGet() >= log.verboseReversed().debug )
log.write( strLogPrefix + cc.debug( imaHelperAPIs.longSeparator ) + "\n" );
if( ( optsLoop.enableStepOracle && imaState.loopState.oracle.isInProgress ) ||
( optsLoop.enableStepM2S && imaState.loopState.m2s.isInProgress ) ||
( optsLoop.enableStepS2M && imaState.loopState.s2m.isInProgress ) ||
( optsLoop.enableStepS2S && imaState.loopState.s2s.isInProgress )
) {
imaState.loopState.oracle.wasInProgress = false;
imaState.loopState.m2s.wasInProgress = false;
imaState.loopState.s2m.wasInProgress = false;
imaState.loopState.s2s.wasInProgress = false;
if( log.verboseGet() >= log.verboseReversed().warning ) {
log.write( strLogPrefix + cc.warning( "Skipped due to other single " +
"transfer loop is in progress right now" ) + "\n" );
}
return true;
}
const b0 = await singleTransferLoopPartOracle( optsLoop, strLogPrefix );
const b1 = await singleTransferLoopPartM2S( optsLoop, strLogPrefix );
const b2 = await singleTransferLoopPartS2M( optsLoop, strLogPrefix );
const b3 = await singleTransferLoopPartS2S( optsLoop, strLogPrefix );
let b0 = false, b1 = false, b2 = false, b3 = false;
// Oracle loop part:
if( optsLoop.enableStepOracle ) {
if( imaState.loopState.oracle.isInProgress ) {
imaState.loopState.oracle.wasInProgress = false;
printLoopPartSkippedWarning( "Oracle" );
b0 = true;
} else
b0 = await singleTransferLoopPartOracle( optsLoop, strLogPrefix );
} else
b0 = true;
// M2S loop part:
if( optsLoop.enableStepM2S ) {
if( imaState.loopState.m2s.isInProgress ) {
imaState.loopState.m2s.wasInProgress = false;
printLoopPartSkippedWarning( "M2S" );
b1 = true;
} else
b1 = await singleTransferLoopPartM2S( optsLoop, strLogPrefix );
} else
b1 = true;
// S2M loop part:
if( optsLoop.enableStepS2M ) {
if( imaState.loopState.s2m.isInProgress ) {
imaState.loopState.s2m.wasInProgress = false;
printLoopPartSkippedWarning( "S2M" );
b2 = true;
} else
b2 = await singleTransferLoopPartS2M( optsLoop, strLogPrefix );
} else
b2 = true;
// S2S loop part:
if( optsLoop.enableStepS2S ) {
if( imaState.loopState.s2s.isInProgress ) {
imaState.loopState.s2s.wasInProgress = false;
printLoopPartSkippedWarning( "S2S" );
b3 = true;
} else
b3 = await singleTransferLoopPartS2S( optsLoop, strLogPrefix );
} else
b3 = true;
// Final status check loop part:
const bResult = b0 && b1 && b2 && b3;
if( log.verboseGet() >= log.verboseReversed().notice )
log.write( strLogPrefix + cc.debug( "Completed: " ) + cc.tf( bResult ) + "\n" );
if( log.verboseGet() >= log.verboseReversed().notice ) {
log.write( strLogPrefix +
cc.debug( "Final completion status for all performed transfer loop parts is " ) +
cc.tf( bResult ) + "\n" );
}
return bResult;
} catch ( err ) {
if( log.verboseGet() >= log.verboseReversed().error ) {
log.write( strLogPrefix + cc.fatal( "Exception in single transfer loop: " ) +
log.write( strLogPrefix + cc.fatal( "Exception in transfer loop: " ) +
cc.warning( owaspUtils.extractErrorMessage( err ) ) +
cc.error( ", stack is: " ) + "\n" + cc.stack( err.stack ) + "\n" );
}
Expand Down