Build: #320 was successful Changes by Rui Xue and Akeem Wells

Stages & jobs

  1. Default Stage

  2. Test

Build result summary

Details

Completed
Queue duration
< 1 second
Duration
40 minutes
Labels
None
Revision
44d9e7387ac3f53b7841b93a583e1354e361c06f
Total tests
696
First to pass since
#318 (Changes by Kumar Golap)

Tests

Code commits

Author Commit Message Commit date
Rui Xue Rui Xue 44d9e7387ac3f53b7841b93a583e1354e361c06f Pull request #1040: CAS-14622
Merge in CASA/casa6 from CAS-14622 to master

* commit '6599d358e517e2dc3f94260a0d8770dd0cc64964':
  CAS-14622: Fix out-of-bounds MPI segmentation faults in BriggsCubeWeightor
  CAS-14622: Fix ncores-dependent tclean segmentation fault in `BriggsCubeWeightor`
Akeem Wells Akeem Wells 6599d358e517e2dc3f94260a0d8770dd0cc64964 Merge branch 'master' into CAS-14622
Akeem Wells Akeem Wells fe4695a054c35ccb9b648d91e0871c322bc267ad m Merge branch 'master' into CAS-14622
Rui Xue Rui Xue 8fbe09615738a7a02c5c218a2ba4598911874183 m CAS-14622: Fix out-of-bounds MPI segmentation faults in BriggsCubeWeightor
The SynthesisImager uses BriggsCubeWeightor to compute weights for the image cube. During distributed MPI execution (`ncores > 1`), the output cube's spectral axis is partitioned across multiple nodes into smaller local subcubes.

When evaluating MS data channels, `GridFT::channelMap` maps the visibilities' frequencies into the local subcube's channel indices. If an MS contains dataset frequencies (e.g., from large Doppler swings or wide ephemeris velocity changes) that land *above* the local MPI subcube's maximum channel, `channelMap` returns an index exceeding the local array bounds.

Previously, BriggsCubeWeightor only checked the lower bound (`chanMap(chn) > -1`) before using the calculated index to access `wgtDensity` and the `f2_p`/`d2_p` arrays. Accessing these arrays with indices belonging to higher MPI partitions resulted in unconstrained out-of-bounds memory accesses, causing silent heap corruption or explicit Segmentation Faults, heavily dependent on the MPI slicing and dataset footprint.

This commit resolves the issue by introducing strict upper-bound channel footprint constraints (`chanMap(chn) < shape()[3]`) in both `weightUniform` and `getWeightUniform`. Data channels that mathematically fall outside the upper bounds of the local MPI partition are now securely ignored.
Rui Xue Rui Xue 3000ee0fe103736833f139a6c7dbdf3eca4abb82 m CAS-14622: Fix ncores-dependent tclean segmentation fault in `BriggsCubeWeightor`
The SynthesisImager uses `BriggsCubeWeightor` to compute weights for the image cube. During this calculation, `BriggsCubeWeightor::cube2Matrix` extracts raw storage pointers `pcube` and `pflags` from `casacore::Array::getStorage(deleteIt)`.

Previously, the code incremented these exact pointers (`*pflags = *pcube++`) during array traversal. At the end of the function, the incremented pointers were passed directly to `freeStorage()` and `putStorage()`.

When array memory isn't contiguous (which occurs when data is sliced across MPI ranks), `getStorage()` allocates a temporary buffer and sets `deleteIt = true`. Passing the shifted pointer into `freeStorage()` invokes `delete[]` on an invalid memory address, causing heap corruption and a Segmentation fault randomly depending on the data slicing.

This commit resolves the issue by securely caching the original pointers returned from `getStorage` into distinct variables. The traversal loops now use separate copies of these pointers, enabling the original allocation addresses to be correctly evaluated and freed by `freeStorage()` and `putStorage()`.

Jira issues

IssueDescriptionStatus
Unknown Issue TypeCAS-14622Could not obtain issue details from Jira

Shared artifacts

Artifact File size
ManyLinux228 Casatestutils 156 KB
ManyLinux228 Python 3.12 Tool wheel 75 MB