MantisBT - Community
View Issue Details
0031147Community[OCCT] OCCT:Modeling Algorithmspublic2019-11-10 18:262021-05-15 15:34
Vico Liang 
bugmaster 
normalminor 
verifiedfixed 
[OCCT] 7.4.0 
[OCCT] 7.6.0* 
pipe/bugs/bug31147
0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
    TopoDS_Wire aSpine = ... ;//"pipeShell-fail.brep"
    TopoDS_Wire aWire = ... ;//"pipeShell-fail.brep"

    BRepOffsetAPI_MakePipeShell aMakePipe(aSpine);
    aMakePipe.Add(aWire, Standard_False, Standard_False);

    aMakePipe.SetTransitionMode(BRepBuilderAPI_RoundCorner);
    aMakePipe.SetDiscreteMode();
    aMakePipe.SetTolerance();
    aMakePipe.Build();

// Null access occurs as below function stacktrace:
TKBool.dll!BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep & theSweep) Line 1443 C++
     TKBool.dll!BRepFill_PipeShell::Build() Line 795 C++
     TKOffset.dll!BRepOffsetAPI_MakePipeShell::Build() Line 259 C++





test pipe bugs bug31147
No tags attached.
related to 0032343feedback szy Community Modeling Algorithms - Pipe does not represent the profiles' shapes 
? pipeshell-fail.brep (9,084) 2019-11-10 18:26
https://tracker.dev.opencascade.org/
png pipeshell-fail.png (40,653) 2019-11-10 18:26
https://tracker.dev.opencascade.org/
png pipeshell-fail-shape.png (14,630) 2019-11-10 18:27
https://tracker.dev.opencascade.org/
? spine_28.brep (29,961) 2021-03-03 12:24
https://tracker.dev.opencascade.org/
? profile_28_1.brep (2,267) 2021-03-03 12:24
https://tracker.dev.opencascade.org/
? profile_28_2.brep (2,276) 2021-03-03 12:24
https://tracker.dev.opencascade.org/
? profile_28_3.brep (1,609) 2021-03-03 12:24
https://tracker.dev.opencascade.org/
? profile_28_4.brep (1,529) 2021-03-03 12:25
https://tracker.dev.opencascade.org/
? profile_28_5.brep (1,653) 2021-03-03 12:25
https://tracker.dev.opencascade.org/
? profile_28_6.brep (1,405) 2021-03-03 12:25
https://tracker.dev.opencascade.org/
? spine_28_7.5.0.brep (29,965) 2021-03-15 16:59
https://tracker.dev.opencascade.org/
? profile_28_1_7.5.0.brep (2,271) 2021-03-15 16:59
https://tracker.dev.opencascade.org/
? profile_28_2_7.5.0.brep (2,280) 2021-03-15 16:59
https://tracker.dev.opencascade.org/
? profile_28_3_7.5.0.brep (1,613) 2021-03-15 16:59
https://tracker.dev.opencascade.org/
? profile_28_4_7.5.0.brep (1,533) 2021-03-15 16:59
https://tracker.dev.opencascade.org/
? profile_28_5_7.5.0.brep (1,657) 2021-03-15 17:00
https://tracker.dev.opencascade.org/
? profile_28_6_7.5.0.brep (1,409) 2021-03-15 17:00
https://tracker.dev.opencascade.org/
? spine_144_CR31147.brep (17,411) 2021-04-30 10:40
https://tracker.dev.opencascade.org/
? profile_144_CR31147.brep (2,266) 2021-04-30 10:40
https://tracker.dev.opencascade.org/
zip test_512.zip (4,121) 2021-04-30 16:21
https://tracker.dev.opencascade.org/
zip test_101.zip (8,005) 2021-05-06 13:34
https://tracker.dev.opencascade.org/
zip test_177.zip (3,925) 2021-05-12 10:04
https://tracker.dev.opencascade.org/
zip test_951.zip (3,499) 2021-05-12 10:04
https://tracker.dev.opencascade.org/
zip test_8879.zip (3,664) 2021-05-12 10:04
https://tracker.dev.opencascade.org/
Issue History
2019-11-10 18:26Vico LiangNew Issue
2019-11-10 18:26Vico LiangAssigned To => msv
2019-11-10 18:26Vico LiangFile Added: pipeshell-fail.brep
2019-11-10 18:26Vico LiangFile Added: pipeshell-fail.png
2019-11-10 18:27Vico LiangFile Added: pipeshell-fail-shape.png
2019-12-17 13:29kgvSummaryBRepOffsetAPI_MakePipeShell null access => Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
2020-09-15 12:47msvTarget Version7.5.0 => 7.6.0*
2021-03-03 12:23Jerome CaucatNote Added: 0099331
2021-03-03 12:24Jerome CaucatFile Added: spine_28.brep
2021-03-03 12:24Jerome CaucatFile Added: profile_28_1.brep
2021-03-03 12:24Jerome CaucatFile Added: profile_28_2.brep
2021-03-03 12:24Jerome CaucatFile Added: profile_28_3.brep
2021-03-03 12:25Jerome CaucatFile Added: profile_28_4.brep
2021-03-03 12:25Jerome CaucatFile Added: profile_28_5.brep
2021-03-03 12:25Jerome CaucatFile Added: profile_28_6.brep
2021-03-15 16:56Jerome CaucatNote Added: 0099528
2021-03-15 16:59Jerome CaucatFile Added: spine_28_7.5.0.brep
2021-03-15 16:59Jerome CaucatFile Added: profile_28_1_7.5.0.brep
2021-03-15 16:59Jerome CaucatFile Added: profile_28_2_7.5.0.brep
2021-03-15 16:59Jerome CaucatFile Added: profile_28_3_7.5.0.brep
2021-03-15 16:59Jerome CaucatFile Added: profile_28_4_7.5.0.brep
2021-03-15 17:00Jerome CaucatFile Added: profile_28_5_7.5.0.brep
2021-03-15 17:00Jerome CaucatFile Added: profile_28_6_7.5.0.brep
2021-04-27 17:20szyNote Added: 0100617
2021-04-27 17:20szyAssigned Tomsv => akaftasev
2021-04-27 17:20szyStatusnew => assigned
2021-04-27 17:22szyNote Edited: 0100617bug_revision_view_page.php?bugnote_id=100617#r25112
2021-04-29 11:30akaftasevRelationship addedrelated to 0031984
2021-04-29 13:42gitNote Added: 0100663
2021-04-30 10:40Jerome CaucatFile Added: spine_144_CR31147.brep
2021-04-30 10:40Jerome CaucatFile Added: profile_144_CR31147.brep
2021-04-30 10:41Jerome CaucatNote Added: 0100685
2021-04-30 12:56akaftasevNote Added: 0100694
2021-04-30 13:09gitNote Added: 0100696
2021-04-30 13:10gitNote Added: 0100697
2021-04-30 13:40Jerome CaucatNote Added: 0100698
2021-04-30 16:21Jerome CaucatFile Added: test_512.zip
2021-04-30 16:21Jerome CaucatNote Added: 0100702
2021-04-30 18:13akaftasevNote Added: 0100705
2021-04-30 18:19akaftasevNote Added: 0100706
2021-04-30 18:27Jerome CaucatNote Added: 0100707
2021-04-30 18:35akaftasevRelationship addedrelated to 0032343
2021-04-30 18:42akaftasevNote Added: 0100708
2021-05-04 12:55Jerome CaucatNote Added: 0100753
2021-05-04 13:16Jerome CaucatNote Edited: 0100753bug_revision_view_page.php?bugnote_id=100753#r25138
2021-05-04 13:51akaftasevAssigned Toakaftasev => jgv
2021-05-04 13:51akaftasevStatusassigned => resolved
2021-05-04 13:51akaftasevSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=25140#r25140
2021-05-04 14:03akaftasevNote Added: 0100758
2021-05-04 14:03akaftasevNote Added: 0100759
2021-05-05 13:56kgvNote Added: 0100780
2021-05-05 13:58kgvNote Edited: 0100780bug_revision_view_page.php?bugnote_id=100780#r25144
2021-05-05 15:31jgvNote Added: 0100782
2021-05-05 15:31jgvStatusresolved => assigned
2021-05-05 15:31jgvAssigned Tojgv => akaftasev
2021-05-06 10:40gitNote Added: 0100793
2021-05-06 13:34Jerome CaucatFile Added: test_101.zip
2021-05-06 13:34Jerome CaucatNote Added: 0100795
2021-05-06 19:47gitNote Added: 0100804
2021-05-07 10:14gitNote Added: 0100807
2021-05-07 13:17akaftasevAssigned Toakaftasev => jgv
2021-05-07 13:17akaftasevStatusassigned => resolved
2021-05-07 13:17akaftasevSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=25148#r25148
2021-05-11 10:40kgvNote Added: 0100867
2021-05-11 11:25jgvNote Added: 0100871
2021-05-11 11:25jgvAssigned Tojgv => akaftasev
2021-05-11 11:25jgvStatusresolved => assigned
2021-05-11 20:04gitNote Added: 0100891
2021-05-12 10:04Jerome CaucatFile Added: test_177.zip
2021-05-12 10:04Jerome CaucatFile Added: test_951.zip
2021-05-12 10:04Jerome CaucatFile Added: test_8879.zip
2021-05-12 10:05Jerome CaucatNote Added: 0100910
2021-05-13 11:12gitNote Added: 0100934
2021-05-13 11:13akaftasevAssigned Toakaftasev => jgv
2021-05-13 11:13akaftasevStatusassigned => resolved
2021-05-13 11:21kgvNote Added: 0100935
2021-05-13 11:37gitNote Added: 0100938
2021-05-13 14:01jgvNote Added: 0100945
2021-05-13 14:01jgvAssigned Tojgv => akaftasev
2021-05-13 14:01jgvStatusresolved => assigned
2021-05-13 14:04gitNote Added: 0100946
2021-05-13 14:05akaftasevAssigned Toakaftasev => jgv
2021-05-13 14:05akaftasevStatusassigned => resolved
2021-05-14 11:12jgvNote Added: 0100985
2021-05-14 11:12jgvAssigned Tojgv => akaftasev
2021-05-14 11:12jgvStatusresolved => assigned
2021-05-14 11:12jgvAssigned Toakaftasev => msv
2021-05-14 11:12jgvStatusassigned => resolved
2021-05-14 11:12jgvAssigned Tomsv => bugmaster
2021-05-14 11:12jgvStatusresolved => reviewed
2021-05-15 14:02bugmasterNote Added: 0101018
2021-05-15 14:02bugmasterStatusreviewed => tested
2021-05-15 14:09bugmasterTest case number => pipe/bugs/bug31147
2021-05-15 14:16bugmasterChangeset attached => occt master 8d52a74d
2021-05-15 14:16bugmasterStatustested => verified
2021-05-15 14:16bugmasterResolutionopen => fixed
2021-05-15 15:34gitNote Added: 0101027
2021-05-15 15:34gitNote Added: 0101038

Notes
(0099331)
Jerome Caucat   
2021-03-03 12:23   
I encounter the same problem (Segmentation fault in BRepFill_PipeShell::BuildHistory(BRepFill_Sweep const&)) with the attached spine_28 and profile_28_* and the following c++ code:

BRepOffsetAPI_MakePipeShell pipeBuilder(spine);
pipeBuilder.SetTransitionMode(BRepBuilderAPI_RightCorner);
pipeBuilder.SetDiscreteMode();
for (const auto& profile : profiles)
    pipeBuilder.Add(profile);
pipeBuilder.Build(); // <- Crash
pipeBuilder.MakeSolid();

I also experience the crash in DRAW (An exception was caught 0x556a7ad59720 : OSD_SIGSEGV: SIGSEGV 'segmentation violation' detected. Address 8.) with the following code:

pload ALL
restore /tmp/spine_28.brep s
restore /tmp/profile_28_1.brep p1
restore /tmp/profile_28_2.brep p2
restore /tmp/profile_28_3.brep p3
restore /tmp/profile_28_4.brep p4
restore /tmp/profile_28_5.brep p5
restore /tmp/profile_28_6.brep p6
mksweep s
setsweep -DT
addsweep p1
addsweep p2
addsweep p3
addsweep p4
addsweep p5
addsweep p6
buildsweep r -C -S
vdisplay s p1 p2 p3 p4 p5 p6 r
vfit

Note that if I "invert s" before "mksweep s" in the DRAW code above the crash is gone but the pipe's shape does not represent profiles' shape, it is sort of flattened.

- Linux Ubuntu 20.04 64-bit
- Version 7.5
(0099528)
Jerome Caucat   
2021-03-15 16:56   
I actually exported those files with the latest version of OCE that I used to test if my problem had been fixed, I had not realized that the exported brep would be different, I'll now upload the files exported with the version 7.5.0.
(0100617)
szy   
2021-04-27 17:20   
(edited on: 2021-04-27 17:22)
Analyze, please the issue and send me WL estimation.

(0100663)
git   
2021-04-29 13:42   
Branch CR31147 has been created by andrey.kaftasev_159541.

SHA-1: 7cf12dabd2c1d338cb941c5e9f9779390c750473


Detailed log of new commits:

Author: akaftasev
Date: Thu Apr 29 13:40:58 2021 +0300

    0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
    
    Changed degmax and segmax for testing
(0100685)
Jerome Caucat   
2021-04-30 10:41   
Hi, thanks for the progress made.

I tried the branch CR31147:

- The crash does not happen anymore on the spine/profile_28 files I provided above in https://tracker.dev.opencascade.org/view.php?id=31147#c99331. [^]
- However I am still not able to correctly construct the pipe: depending on the options used with setsweep the shape is either not constructed or does not correspond to the profile. This can be reproduced in DRAW using the code I provided in https://tracker.dev.opencascade.org/view.php?id=31147#c99331. [^]
- I am experiencing a crash with the files spine_144_CR31147.brep and profile_144_CR31147.brep that I just provided, also reproducible in DRAW: "An exception was caught 0x558bd8dd4b30 : OSD_SIGSEGV: SIGSEGV 'segmentation violation' detected. Address 0".
(0100694)
akaftasev   
2021-04-30 12:56   
Dear Jerome Caucat, you can build correct pipe without exceprion from spine_144_CR31147.brep and profile_144_CR31147.brep by using pipe command:

pload ALL
spine_144_CR31147.brep s
restore profile_144_CR31147.brep p

pipe r s p

vdisplay s p r
vfit
(0100696)
git   
2021-04-30 13:09   
Branch CR31147 has been deleted by andrey.kaftasev_159541.

SHA-1: 7cf12dabd2c1d338cb941c5e9f9779390c750473
(0100697)
git   
2021-04-30 13:10   
Branch CR31147 has been created by andrey.kaftasev_159541.

SHA-1: 7c6032f170e49e65a648dd5bfdb799e49841ac3e


Detailed log of new commits:

Author: akaftasev
Date: Thu Apr 29 13:40:58 2021 +0300

    0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
    
    Added Draw command 'setsweepparams' to change degmax and segmax parameter manually
(0100698)
Jerome Caucat   
2021-04-30 13:40   
Dear akaftasev,

> Dear Jerome Caucat, you can build correct pipe without exceprion from spine_144_CR31147.brep and profile_144_CR31147.brep by using pipe command:

Ok, but then the pipe is not closed at its ends and is not a solid, I guess I would have to close it myself.

BTW for this particular case I am able to construct it using "setsweep -CN 0 0 1", however I don't know how I can programmatically determine what settings should be used (-CN, -DT, etc.), is this doable?
If the function did not crash I suppose I could try different settings in case of error.
(0100702)
Jerome Caucat   
2021-04-30 16:21   
Please find in test_512.zip a spine and profiles for which the pipe construction used to crash before the fix. After CR31147 the pipe construction does not crash anymore but the pipe is deformed.
(0100705)
akaftasev   
2021-04-30 18:13   
In last version of current fix, you can manually set parameters of approximation for sweep algorithm by Draw command 'setsweepparams':
increasing parameters -SM and -DM improves resulting tolerance of approximation, but decreases performance.

For shapes, presented in current bug, an increase in parameters -SM and -DM made it possible to build resulting pipe.
(0100706)
akaftasev   
2021-04-30 18:19   
Unfortunately, there no method programmatically determine settings to algorithm and need to determine its manually.
(0100707)
Jerome Caucat   
2021-04-30 18:27   
Thanks I will try the new DRAW.

I cannot change the settings manually for every pipes, the code will have to be generic or automatically adapt its settings...

I'll do more testings.
(0100708)
akaftasev   
2021-04-30 18:42   
Jerome Caucat, for your case, was created new bug, because problem, described in current bug differs from yours, and will be solved with another fix.

You can see your bug by link upper in relationships to current bug.
(0100753)
Jerome Caucat   
2021-05-04 12:55   
(edited on: 2021-05-04 13:16)
For information here are the results of my tests with the DRAW from CR31147 and using buildsweep r -C -S:

Sample 28:
  default: pipe is distorted
  setsweep -FR: fail (not done)
  setsweep -CF: pipe is distorted
  setsweep -CN 1 0 0: pipe is distorted
  setsweep -CN 0 1 0: almost good, pipe is a little distorted
  setsweep -CN 0 0 1: fail (exception Standard_NullObject)
  setsweep -DT: fail (exception Standard_NullObject)

Sample 144:
  default: crash
  setsweep -FR: crash
  setsweep -CF: crash
  setsweep -CN 1 0 0: almost good, pipe is a little distorted
  setsweep -CN 0 1 0: OK, pipe is good
  setsweep -CN 0 0 1: OK, pipe is good
  setsweep -DT: crash

Sample 512:
  default: fail (not done)
  setsweep -FR: fail (exception Standard_NullObject)
  setsweep -CF: fail (not done)
  setsweep -CN 1 0 0: pipe is distorted
  setsweep -CN 0 1 0: almost good, pipe is a little distorted
  setsweep -CN 0 0 1: fail (not done)
  setsweep -DT: pipe is distorted

Concerning setsweepparams: I tried several combinations of -SM [0;5000] and -DM [1;14] with the sample 28 and the default setsweep but I could not find one that worked, it either fails with "not done" or result in a distorted shape.

(0100758)
akaftasev   
2021-05-04 14:03   
Branch for review:
OCCT - CR31147
(0100759)
akaftasev   
2021-05-04 14:03   
Results of testing:
http://jenkins-test-occt/view/CR31147-master-akaftasev/view/COMPARE/ [^]
(0100780)
kgv   
2021-05-05 13:56   
(edited on: 2021-05-05 13:58)
akaftasev, are there any test cases were forgotten to be pushed to branch?
I see new command on the patch, but not any test using it


By the way - are existing commands really cannot be extended with necessary parameters to avoid creating new one?
New command doesn't validate input parameters and ignores unknown parameters, which contradicts to recommended Draw Harness command behavior.
Please also move command help to command registration instead of obsolete style 'please run command without arguments'.

(0100782)
jgv   
2021-05-05 15:31   
Dear Andrey,

Kirill is right: please, do the following:

1. Rebase your branch on current master.
2. Modify existing Draw command "setsweep" instead of creating new command.
3. Add test case: soon I will add the input shape to database with the name bug31147.brep.
(0100793)
git   
2021-05-06 10:40   
Branch CR31147_1 has been created by andrey.kaftasev_159541.

SHA-1: 8bde94d2ce591ebcb9aee9afa345f3b25fbbb22c


Detailed log of new commits:

Author: akaftasev
Date: Thu Apr 29 13:40:58 2021 +0300

    0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
    
    Added to Draw command 'setsweep ' posibility to change degmax and segmax parameter manually by '-SM' and '-DM' options
    Added test
(0100795)
Jerome Caucat   
2021-05-06 13:34   
For information I still experience a crash (Segmentation fault in BRepFill_PipeShell::BuildHistory) for the provided sample 144 (profile/spine_144_CR31147) and the newly added sample 101 (test_101.zip).
(0100804)
git   
2021-05-06 19:47   
Branch CR31147_1 has been updated forcibly by andrey.kaftasev_159541.

SHA-1: 0a010671fc62a92c1fd6f5c904b14215e805608e
(0100807)
git   
2021-05-07 10:14   
Branch CR31147_1 has been updated forcibly by andrey.kaftasev_159541.

SHA-1: a3bc100fbd2b8c5cc4a9c84ed22942e1daac132f
(0100867)
kgv   
2021-05-11 10:40   
Andrey, even if changing input parameters helps constructing the pipe, it is not OK to allow NULL dereference in case of unfortunate algorithm parameters - please also add necessary NULL checks to the algorithm (cannot say if it should be done at BRepFill_PipeShell::BuildHistory() where crash occurs or somewhere earlier, as I'm not familiar with this code) - instead algorithm should report failure (if it provides such interface) or explicitly raise another exception.
(0100871)
jgv   
2021-05-11 11:25   
Andrey, please also add call of the command "errorsweep" in the test case after "buildsweep" - to check the error of approximation.

(0100891)
git   
2021-05-11 20:04   
Branch CR31147_1 has been updated by andrey.kaftasev_159541.

SHA-1: 86ef102a009c0147a7ee0d2d9267aad348d3a1fb


Detailed log of new commits:

Author: akaftasev
Date: Tue May 11 20:04:34 2021 +0300

    Added new condition to prevent crash

(0100910)
Jerome Caucat   
2021-05-12 10:05   
Hi, I just tested the latest commit, the crash is now fixed for the samples 144 and 101, thanks.

I added three other samples still presenting a crash:
- test_177.zip
- test_951.zip
- test_8879.zip

I am using the branch CR31147_1 with CR29645 merged and the -DT/SetDiscreteMode() option.
(0100934)
git   
2021-05-13 11:12   
Branch CR31147_1 has been updated forcibly by andrey.kaftasev_159541.

SHA-1: f822e2a694df7730aba94b3b06c0e46dc670e2b6
(0100935)
kgv   
2021-05-13 11:21   
Andrey,
+      if (aVshape.TShape().IsNull())

TopoDS_Shape class has TopoDS_Shape::IsNull() method - no need to access TShape().
(0100938)
git   
2021-05-13 11:37   
Branch CR31147_1 has been updated forcibly by andrey.kaftasev_159541.

SHA-1: 99bb529550ede446ce617828b7818c208122d3a7
(0100945)
jgv   
2021-05-13 14:01   
Please correct usage of command "errorsweep" in test case
(0100946)
git   
2021-05-13 14:04   
Branch CR31147_1 has been updated forcibly by andrey.kaftasev_159541.

SHA-1: 6dec9879f4356383d780b880f2ab227a76ac79ba
(0100985)
jgv   
2021-05-14 11:12   
Reviewed.

Branches for integration:
OCCT – CR31147_1
Products – NOT
(0101018)
bugmaster   
2021-05-15 14:02   
Combination -
OCCT branch : IR-2021-05-14
master SHA - d1b8120b699dfa46c9899f70430ec45a0c4e4a95
a87b7ddc8cb44606b91e3f37113847c3f5f50fdc
Products branch : IR-2021-05-14 SHA - c56cdc236ba39874bae48cf231ece00c0876d871
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17874.080000000333 / 17899.800000000352 [-0.14%]
Products
Total CPU difference: 11557.880000000083 / 11563.54000000011 [-0.05%]
Windows-64-VC14:
OCCT
Total CPU difference: 19394.921875 / 19369.625 [+0.13%]
Products
Total CPU difference: 12880.234375 / 12896.03125 [-0.12%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0101027)
git   
2021-05-15 15:34   
Branch CR31147_1 has been deleted by inv.

SHA-1: 6dec9879f4356383d780b880f2ab227a76ac79ba
(0101038)
git   
2021-05-15 15:34   
Branch CR31147 has been deleted by inv.

SHA-1: 7c6032f170e49e65a648dd5bfdb799e49841ac3e