Hello Aspose team,
I encountered double free memory or corruption when converting multiple Excel files to image (JPEG) on Linux concurrently. It happened randomly so it’s quite hard to reproduce. I also attached the backtrace on error for more information.
Environment : Aspose.Cells 22.3, CentOS 7, .NET 6.0
Code :
var options = new ImageOrPrintOptions
{
OnePagePerSheet = false,
ImageType = ImageType.Jpeg,
PrintingPage = PrintingPageType.Default
};
foreach(var sheet in workbook.Worksheets)
{
var sr = new SheetRender(sheet, options);
for(int j = 0; j < sr.PageCount; j++)
{
var imgOut = $“outfile_{j}.jpg”
sr.ToImage(j, imgOut);
}
}
Backtrace on error :
aspose_cells_issue.png (5.3 KB)
@dunghnguyen ,
It is hard to evaluate your issue based on your given details and artifacts. Also, your issue occurred randomly as you pointed out. We need a simulation project with template file(s) to reproduce the issue on our end. So, please share with us a simulation project with sample files to reproduce the issue. We will check your issue soon.
@Amjad_Sahi
Please find the test program and samples attached. Then run it a few times until the issue happens.
cell_test.zip (2.4 KB)
xlsx_sample.zip (596.0 KB)
Example output:
cells__1.png (27.9 KB)
leoluo
April 15, 2022, 7:22am
4
Hi @dunghnguyen
I can run your project, and test dozens of times, but the problem didn’t happen.
My test Environment is Ubuntu20.04, net6, memory 2GB.
I noticed that the 4 test files you provided had previously solved a problem caused by a special character, but the next version will take effect.
Can you remove the special characters in 4 files, so that all the pictures generate normally, try test in your environment, whether there is any “coredump” exception found?
Hi @leoluo .
I try with another set of samples and can reproduce the problem. Below is more details about my test environment and samples, and core dump attached.
$ uname -a
Linux localhost.localdomain 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.201
Commit: ef40e6aa06
Runtime Environment:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /usr/share/dotnet/sdk/6.0.201/
Host (useful for support):
Version: 6.0.3
Commit: c24d9a9c91
.NET SDKs installed:
3.1.417 [/usr/share/dotnet/sdk]
6.0.201 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.23 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.23 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
$ yum list installed | grep gdi
libgdiplus0.x86_64 6.0.5-0.xamarin.1.epel7 @mono-centos7-stable
$ yum deplist libgdiplus0.x86_64
package: libgdiplus0.x86_64 6.0.5-0.xamarin.1.epel7
dependency: /sbin/ldconfig
provider: glibc.x86_64 2.17-325.el7_9
provider: glibc.i686 2.17-325.el7_9
dependency: libX11.so.6()(64bit)
provider: libX11.x86_64 1.6.7-4.el7_9
dependency: libc.so.6(GLIBC_2.14)(64bit)
provider: glibc.x86_64 2.17-325.el7_9
dependency: libcairo.so.2()(64bit)
provider: cairo.x86_64 1.15.12-4.el7
dependency: libexif.so.12()(64bit)
provider: libexif.x86_64 0.6.22-2.el7_9
dependency: libfontconfig.so.1()(64bit)
provider: fontconfig.x86_64 2.13.0-4.3.el7
dependency: libfreetype.so.6()(64bit)
provider: freetype.x86_64 2.8-14.el7_9.1
dependency: libgif.so.4()(64bit)
provider: giflib.x86_64 4.1.6-9.el7
dependency: libglib-2.0.so.0()(64bit)
provider: glib2.x86_64 2.56.1-9.el7_9
dependency: libjpeg.so.62()(64bit)
provider: libjpeg-turbo.x86_64 1.2.90-8.el7
dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit)
provider: libjpeg-turbo.x86_64 1.2.90-8.el7
dependency: libm.so.6()(64bit)
provider: glibc.x86_64 2.17-325.el7_9
dependency: libm.so.6(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-325.el7_9
dependency: libpng15.so.15()(64bit)
provider: libpng.x86_64 2:1.5.13-8.el7
dependency: libpng15.so.15(PNG15_0)(64bit)
provider: libpng.x86_64 2:1.5.13-8.el7
dependency: libpthread.so.0()(64bit)
provider: glibc.x86_64 2.17-325.el7_9
dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-325.el7_9
dependency: libtiff.so.5()(64bit)
provider: libtiff.x86_64 4.0.3-35.el7
dependency: libtiff.so.5(LIBTIFF_4.0)(64bit)
provider: libtiff.x86_64 4.0.3-35.el7
dependency: libz.so.1()(64bit)
provider: zlib.x86_64 1.2.7-19.el7_9
dependency: rtld(GNU_HASH)
provider: glibc.x86_64 2.17-325.el7_9
provider: glibc.i686 2.17-325.el7_9
Sample : sample__2.zip (679.2 KB)
Coredump : Encl: Send files to anyone easily and securely (too large to attach, expires in 7 days)
Many thanks!
leoluo
April 18, 2022, 9:23am
6
Hi @dunghnguyen
Please check my libgdiplus and environment:
[asposecells@aspose ~]$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /usr/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
3.1.415 [/usr/share/dotnet/sdk]
6.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
.NET Downloads (Linux, macOS, and Windows)
[asposecells@aspose ~]$ yum list installed | grep gdi
Repository packages-microsoft-com-prod is listed more than once in the configuration
libgdiplus.x86_64 2.10-10.el7 @epel
leoluo
April 18, 2022, 9:32am
7
I notice that your version is:
libgdiplus0.x86_64 6.0.5-0.xamarin.1.epel7
Mine is:
libgdiplus.x86_64 2.10-10.el7
I’ve looked up some information, and different libgdiplus versions really can lead to different results:
opened 08:11PM - 09 Oct 17 UTC
closed 05:04PM - 01 Feb 22 UTC
area-System.Drawing
disabled-test
test-run-core
We've been plagued by seg faults on Linux in the System.Drawing.Common tests, e.… g. this one on SUSE:
https://mc.dot.net/#/user/stephentoub/pr~2Fjenkins~2Fdotnet~2Fcorefx~2Fmaster~2F/test~2Ffunctional~2Fcli~2F/91ec984d64908b3ab312bef6f6fa599f5ea1cee7/workItem/System.Drawing.Common.Tests/wilogs
```
2017-10-09 19:45:10,371: INFO: proc(54): run_and_log_output: Output: Discovering: System.Drawing.Common.Tests
2017-10-09 19:45:12,085: INFO: proc(54): run_and_log_output: Output: Discovered: System.Drawing.Common.Tests
2017-10-09 19:45:12,654: INFO: proc(54): run_and_log_output: Output: Starting: System.Drawing.Common.Tests
2017-10-09 19:45:13,601: INFO: proc(54): run_and_log_output: Output: System.Drawing.Printing.Tests.PrinterSettingsTests.MaximumCopies_ReturnsExpected [SKIP]
2017-10-09 19:45:13,601: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"IsAnyInstalledPrinters\"
2017-10-09 19:45:13,604: INFO: proc(54): run_and_log_output: Output: System.Drawing.Printing.Tests.PrinterSettingsTests.LandscapeAngle_ReturnsExpected [SKIP]
2017-10-09 19:45:13,604: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"IsAnyInstalledPrinters\"
2017-10-09 19:45:13,606: INFO: proc(54): run_and_log_output: Output: System.Drawing.Printing.Tests.PrinterSettingsTests.Collate_Default_ReturnsExpected [SKIP]
2017-10-09 19:45:13,606: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"IsAnyInstalledPrinters\"
2017-10-09 19:45:13,620: INFO: proc(54): run_and_log_output: Output: System.Drawing.Printing.Tests.PrinterSettingsTests.IsPlotter_ReturnsExpected [SKIP]
2017-10-09 19:45:13,620: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"IsAnyInstalledPrinters\"
2017-10-09 19:45:13,629: INFO: proc(54): run_and_log_output: Output: System.Drawing.Printing.Tests.PrinterSettingsTests.Static_InstalledPrinters_ReturnsExpected [SKIP]
2017-10-09 19:45:13,629: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"IsAnyInstalledPrinters\"
2017-10-09 19:45:14,110: INFO: proc(54): run_and_log_output: Output: MonoTests.System.Drawing.Imaging.PngCodecTest.Bitmap2bitData [SKIP]
2017-10-09 19:45:14,110: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"GetRecentGdiPlusIsAvailable2\"
2017-10-09 19:45:14,110: INFO: proc(54): run_and_log_output: Output: MonoTests.System.Drawing.Imaging.PngCodecTest.Bitmap2bitFeatures [SKIP]
2017-10-09 19:45:14,110: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"GetRecentGdiPlusIsAvailable2\"
2017-10-09 19:45:14,111: INFO: proc(54): run_and_log_output: Output: MonoTests.System.Drawing.Imaging.PngCodecTest.Bitmap2bitPixels [SKIP]
2017-10-09 19:45:14,111: INFO: proc(54): run_and_log_output: Output: Condition(s) not met: \"GetRecentGdiPlusIsAvailable2\"
2017-10-09 19:45:15,499: INFO: proc(54): run_and_log_output: Output: /home/helixbot/dotnetbuild/work/c092864f-24dd-40c6-a4ad-db55569616e0/Work/af3a10a9-a3b8-4472-893f-3ef12b40a6c4/Unzip/RunTests.sh: line 87: 4576 Segmentation fault (core dumped) $RUNTIME_PATH/dotnet xunit.console.netcore.exe System.Drawing.Common.Tests.dll -xml testResults.xml -notrait Benchmark=true -notrait category=nonnetcoreapptests -notrait category=nonlinuxtests -notrait category=OuterLoop -notrait category=failing
2017-10-09 19:45:15,540: INFO: proc(54): run_and_log_output: Output: Trying to find crash dumps for project: System.Drawing.Common.Tests
2017-10-09 19:45:15,540: INFO: proc(54): run_and_log_output: Output: No new dump file was found in /home/helixbot/dotnetbuild/work/c092864f-24dd-40c6-a4ad-db55569616e0/Work/af3a10a9-a3b8-4472-893f-3ef12b40a6c4/Unzip
2017-10-09 19:45:15,542: INFO: proc(54): run_and_log_output: Output: ~/dotnetbuild/work/c092864f-24dd-40c6-a4ad-db55569616e0/Work/af3a10a9-a3b8-4472-893f-3ef12b40a6c4/Unzip
2017-10-09 19:45:15,543: INFO: proc(54): run_and_log_output: Output: Finished running tests. End time=19:45:15. Return value was 139
2017-10-09 19:45:15,544: INFO: proc(58): run_and_log_output: Exit Code: 139
2017-10-09 19:45:15,545: ERROR: scriptrunner(87): _main: Error: No exception thrown, but XUnit results not created
2017-10-09 19:45:15,545: ERROR: helix_test_execution(83): report_error: Error running xunit None
```
This has been happening frequently for months, but I can't find an existing issue for it.
If you can confirm how you installed this libgdiplus version, my install command is:
sudo yum install libgdiplus
Hi @leoluo .
I followed the instruction here to install libgdiplus.
Thank you.
@dunghnguyen ,
Thanks for your confirmation.
We have logged an investigation ticket with an id “CELLSNETCORE-379” for your issue. We will evaluate and look into the details of the problem.
Once we have an update on it, we will let you know.
1 Like
Hi @amjad.sahi , is there any update on this?
John.He
September 27, 2023, 3:26am
11
@dunghnguyen
No updates on your issue. Once we have any new information, we will share it with you. We will get back to you soon.
leoluo
September 27, 2023, 3:44am
12
Hi @dunghnguyen
I noticed that in the error message you used libgdiplus, which I think you used aspose.Cells which should be dependent on the graphics library “System.Drawing.common”.
Because Microsoft claims “system.drawing.common” is no longer supported on Linux:
Since the graphics library is no longer supported, it may have some sorts of unpredictable, random problems under Linux.
Based on this statement, we developed a new aspose.Cells version, depending on the graphics library skiasharp. (At the time you encountered this problem, this version had not yet been released. Now, it’s stable for use.)
Please refer to the documentation below to use SKIASHARP as a graphics library in Linux to solve this problem.