bambulab / BambuStudio

PC Software for BambuLab and other 3D printers
GNU Affero General Public License v3.0
2.16k stars 288 forks source link

Segmentation Fault when using AppImage via CLI on Ubuntu 22.04 #3351

Closed dd-dkenney closed 6 months ago

dd-dkenney commented 10 months ago

Bambu Studio Version

1.8.02.06

Where is the application from?

Bambu Lab github releases, Built from source by yourself or others

OS version

Ubuntu 22.04

Additional system information

DigitalOcean Droplet running Ubuntu 22.04 on x86_64

Printer

BambuLab P1P 0.4mm Nozzle

How to reproduce

Setup environment on Ubuntu 22.04 Server Download AppImage from Github releases with wget Attempt to slice STL with the following command:

/home/slicer/BambuStudio.AppImage --info --debug 6 --orient 1 --arrange 1 --allow-rotations --enable-support="0" --sparse-infill-density="20%" --slice="1-plate" --export-slicedata /home/slicer/server/output/tree-star --outputdir /home/slicer/server/output/tree-star  --load-settings "/Slicer/BambuStudio/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json;/Slicer/BambuStudio/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json" --load-filaments "/Slicer/BambuStudio/resources/profiles/BBL/filament/PolyLite PLA @base.json" --export-3mf slice.3mf /home/slicer/server/uploads/tree-star.stl

Actual results

Receive Segmentation fault (core dumped) response after successful slice.

Expected results

File is successfully sliced and expected output files are provided.

Project file & Debug log uploads

Happens with any STL - no project file produced due to segmentation fault. bambustudio_output.txt

Checklist of files to include

dd-dkenney commented 10 months ago

I receive the same error even when compiling from source with BuildLinux.sh command. gdb provides no additional details beyond what is provided above.

bambu123 commented 10 months ago

I don't believe gdb didn't provide information. At least we can see the crash stack.

dd-dkenney commented 10 months ago

I can provide a coredump of the fault if you'd like - wasn't sure if it would be helpful since bt only gave me what was in the ticket above but have no problem handing one over if it helps!

bambu123 commented 10 months ago

I found no 'bt' output in the log above.

dd-dkenney commented 10 months ago

gdb_output.txt

Here is a run via gdb with bt output included

bambu123 commented 10 months ago

Ok, I will reproduce your operation.

dd-dkenney commented 10 months ago

Investigating this a bit further, I realized something with Ubuntu 23.10 - the following packages were required to be installed before I could even run the AppImage which is somewhat confusing because AppImages are supposed to essentially be self contained - yet the BS AppImage seems to depend on libraries not included in the AppImage.

The reason I point this out is because I'm wondering if the segmentation fault is possibly related to a missing package that isn't being reported for some reason.

Here's a sample of the error I received from one of the run attempts:

root@ubuntu-g-4vcpu-16gb-nyc3-01:~# ./BambuStudio.AppImage --info --debug 6 --orient 1 --arrange 1 --allow-rotations --enable-support="0" --sparse-infill-density="20%" --slice="1-plate" --export-slicedata ~/ --outputdir ~/  --load-settings "/Slicer/BambuStudio/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json;/Slicer/BambuStudio/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json" --load-filaments "/Slicer/BambuStudio/resources/profiles/BBL/filament/PolyLite PLA @base.json" --export-3mf slice.3mf ~/Tree_top_with_star-final.stl
/tmp/.mount_BambuSrpMdYc/bin/bambu-studio: error while loading shared libraries: libgstvideo-1.0.so.0: cannot open shared object file: No such file or directory

Upon installing the specified library, it would move to another until the following list of modules were installed, at which point it reached a segmentation fault with the exact same output as provided already for 22.04.

List of libraries that needed to be installed on a fresh Ubuntu 23.10:

apt install libgl1 libegl1 libgstreamer-plugins-base1.0-0 libwebkit2gtk-4.0-37

Find the gdb output with bt attached as well.

gdb_23.10_output.txt

dd-dkenney commented 10 months ago

Providing some more details hopefully, I created an EC2 instance with Ubuntu 22.04 LTS Desktop with RDP. I downloaded the AppImage from the repo (v1.8.3) and attempted to run the same command with the same results in Terminal with the same file.

However, I can open the AppImage and run BambuStudio GUI perfectly fine along with installing network plugin and slicing file.

bambu123 commented 9 months ago

Providing some more details hopefully, I created an EC2 instance with Ubuntu 22.04 LTS Desktop with RDP. I downloaded the AppImage from the repo (v1.8.3) and attempted to run the same command with the same results in Terminal with the same file.

However, I can open the AppImage and run BambuStudio GUI perfectly fine along with installing network plugin and slicing file.

We are trying to to reproduce this issue.

dd-dkenney commented 9 months ago

I just thought I'd share something additional here that may or may not help - I noticed I get similar results (segmentation fault) when using settings/parameters with other slicers via CLI that don't exist. For example, this happens with CuraEngine - if I pass a parameter which it doesn't know (i.e. a parameter added in a newer version than the one I am using in this instance) - it will not return an error but just encounter a Segmentation fault when slicing a file.

It made me think perhaps the same is happening here?

lanewei120 commented 9 months ago

please pass 0 to slice currently: /home/slicer/BambuStudio.AppImage --info --debug 6 --orient 1 --arrange 1 --allow-rotations --enable-support="0" --sparse-infill-density="20%" --slice="1-plate" --export-slicedata /home/slicer/server/output/tree-star --outputdir /home/slicer/server/output/tree-star --load-settings "/Slicer/BambuStudio/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json;/Slicer/BambuStudio/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json" --load-filaments "/Slicer/BambuStudio/resources/profiles/BBL/filament/PolyLite PLA @base.json" --export-3mf slice.3mf /home/slicer/server/uploads/tree-star.stl

/home/slicer/BambuStudio.AppImage --info --debug 6 --orient 1 --arrange 1 --allow-rotations --enable-support="0" --sparse-infill-density="20%" --slice 0 --export-slicedata /home/slicer/server/output/tree-star --outputdir /home/slicer/server/output/tree-star --load-settings "/Slicer/BambuStudio/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json;/Slicer/BambuStudio/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json" --load-filaments "/Slicer/BambuStudio/resources/profiles/BBL/filament/PolyLite PLA @base.json" --export-3mf slice.3mf /home/slicer/server/uploads/tree-star.stl

we should pass a number to --slice and currently for stl slicing, we need to use 0 for slicing all

dd-dkenney commented 9 months ago

Hey @lanewei120 - when I attempt to do this I receive the following error:

2024-02-04 02:13:02.894325] [0x00007f65ed780c80] [info]    rebuild_plates_after_arrangement:after rebuild, plates count 1
[Tree_star.stl]
size_x = 73.026001
size_y = 74.470001
size_z = 104.598007
min_x = -36.513000
min_y = -37.235001
min_z = -52.299004
max_x = 36.513000
max_y = 37.235001
max_z = 52.299004
number_of_facets = 149970
manifold = yes
number_of_parts =  1
volume = 132041.000000
[2024-02-04 02:13:02.895261] [0x00007f65ed780c80] [info]    Need to slice for plate 0, total plate count 1 partplates!

[2024-02-04 02:13:02.895296] [0x00007f65ed780c80] [info]    Plate 1: pre_check 1, start
[2024-02-04 02:13:02.895311] [0x00007f65ed780c80] [debug]   BuildVolume printable_area clasified as: Rectangle
[2024-02-04 02:13:02.895753] [0x00007f65ed780c80] [info]    update_print_volume_state, print_volume {0, 0, 0} to {200, 200, 100}, got 0 printable istances
[2024-02-04 02:13:02.895765] [0x00007f65ed780c80] [error]   plate 1: Nothing to be sliced, Either the print is empty or no object is fully inside the print volume before apply.

[2024-02-04 02:13:02.895901] [0x00007f65ed780c80] [info]    record_exit_reson:433, saved config to /home/slicer/server/output/tree-star/result.json

run found error, return -50, exit...
[2024-02-04 02:13:02.895928] [0x00007f65ed780c80] [info]    cli_callback_mgr_t::stop enter.
[2024-02-04 02:13:02.895940] [0x00007f65ed780c80] [info]    cli_callback_mgr_t::stop not started before, return directly.
[2024-02-04 02:13:02.895954] [0x00007f65ed780c80] [info]    update_slice_result_valid_state: plate 0 , update slice result from 0 to 0
[2024-02-04 02:13:02.895963] [0x00007f65ed780c80] [info]    update_slice_result_valid_state: plate 0 , update slice result from 0 to 0
[2024-02-04 02:13:02.896636] [0x00007f65ed780c80] [info]    update_slice_result_valid_state: plate 1 , update slice result from 0 to 0
[2024-02-04 02:13:02.896651] [0x00007f65ed780c80] [info]    update_slice_result_valid_state: plate 1 , update slice result from 0 to 0

I found an issue someone created surrounding this potential bug I'm encountering - the gist of that issue was that when using --arrange it would always create an empty Plate 1 and arrange the item on Plate 0, leaving this scenario where the slicer complains that Plate 1 is empty. I can't seem to find it at the moment, but if I do I will share it here.

It recognized the STL and provides sizing for it - but appears to hit this issue and prevent slicing from completing successfully.

Additionally, if I attempt to use the command as provided but change --slice 0 to --slice 1 (I am trying to only slice the plate with the object on it to prevent BambuStudio from attempting to slice the empty Plate 1):

/home/slicer/BambuStudio.AppImage --info --debug 6 --orient 1 --arrange 1 --allow-rotations --enable-support="0" --sparse-infill-density="20%" --slice 1 --export-slicedata /home/slicer/server/output/tree-star --outputdir /home/slicer/server/output/tree-star --load-settings "/Slicer/BambuStudio/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json;/Slicer/BambuStudio/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json" --load-filaments "/Slicer/BambuStudio/resources/profiles/BBL/filament/PolyLite PLA @base.json" --export-3mf slice.3mf /home/slicer/prints/Tree_star.stl

It encounters a segmentation fault before even reaching the point of the previous command (with --slice 0).

Note: This may be a bit of an unrelated tangent - I'm not sure - but figured it was worth mentioning as it sort of deals with the issue at hand.

I'm assuming --slice usage is not as documented in wiki here, and BambuStudio.AppImage --help provides no detail on it's usage either. Wiki says --slice 0 should be all plates, but then the instructions for specifying a specific plate are unclear:

Slice the plates: 0-all plates, i-plate i, others-invalid

If the plates are index based (i.e. 0 is the first plate, 1 is the second, etc.) - how could one slice Plate 0 if 0 is to slice all plates?

Edit: I'm wondering if maybe there is no plate 0 and the CLI debug output of a plate 0 is erroneous? In BambuStudio GUI there's no mention of a Plate 0, and the first plate is always Plate 1 - so this may be a nothing burger.

See the following from the output for examples of what may be leading to my confusion:

[2024-02-04 02:39:31.419286] [0x00007fc79e802c80] [debug]   add_instance: plate_id 0, add instance obj_id 0, instance_id 0, move_position 0
[2024-02-04 02:39:31.419547] [0x00007fc79e802c80] [info]    add_instance: plate 0 , m_ready_for_slice changes to 0

...

Need to slice for plate 0, total plate count 1 partplates!

Then we reach the error, and now it's talking about "Plate 1" - but everything before hand mentioned plate 0:

[2024-02-04 02:39:31.420971] [0x00007fc79e802c80] [error]   plate 1: Nothing to be sliced, Either the print is empty or no object is fully inside the print volume before apply.

I've also gone ahead and attached my full output as well for your review: output.txt

lanewei120 commented 9 months ago

slice 1 has a segment faut bug which we have just fixed internal, and will upload to github later currently you can use slice 0 instead

and from your error " plate 1: Nothing to be sliced, Either the print is empty or no object is fully inside the print volume before apply." it is likely your stl not arranged onto plate 1, maybe too big? you can try with another stl

there are more things need to take care in your command line :

  1. the config should be full config, image
dd-dkenney commented 9 months ago

Now that you mention it, I do see:

update_print_volume_state, print_volume {0, 0, 0} to {200, 200, 100}, got 0 printable istances

Which is odd because I know the build volume should be larger than 200, 200, 100 - my model is slightly taller than 100mm so I can only assume based on your response then, that this may be the cause of the issue I am having. Let me try something really quick and I will return shortly!

lanewei120 commented 9 months ago

that is just because you use the profile from resource directly which is not a full config

image

the p1p's size should be 256x256

0.20mm Standard @BBL P1P.json Bambu Lab P1P 0.4 nozzle.json PolyLite PLA @BBL P1P.json

I just attached the full files of P1P here

dd-dkenney commented 9 months ago

That seemed to fix it - honestly, if the Segmentation Fault is already addressed when attempting to use --slice 1 and --slice 0 works - I think I might be good here - thank you so much for your help! Aside from the --slice 1 issue - this is definitely a RTFM moment - thank you lol

lanewei120 commented 6 months ago

already fixed in 1.9 public beta versions