The JpegFormat() method in GroupDocs.Metadata.dll isn't safe on MTA

Hi Apose team,

We find the JpegFormat() method in GroupDocs.Metadata.dll isn’t safe on MTA.

We have prepared a demo, in this demo, I will get an exception that means there is already added an item with the same key, but I’s sure that the value of variable info is different in different threads.

And I am not sure if there are any other similar methods also have similar problems.

Would you please have a look?

Here is the demo codes:

public class PP
{
public string outpath;
}

public class Test
{
public static void runFunc(object info)
{
try
{
FormatBase format = new JpegFormat(info.ToString());
//FormatBase format = new PdfFormat(info.ToString());
//FormatBase format = new PngFormat(info.ToString());
//FormatBase format = new GifFormat(info.ToString());
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("–>" + e.Message.ToString());
}

}
public static void testFunc()
{
    ThreadPool.SetMinThreads(1, 1);
    ThreadPool.SetMaxThreads(3, 3);

    for (int i = 0; i <= 1000; i++)
    {
        string path = "C:\\Users\\User\\Desktop\\1000 pictures\\" + i + ".JPG";
        ThreadPool.QueueUserWorkItem(new WaitCallback(runFunc), path);
    }

    int count = 0;
    while (true)
    {
        if (count > 50) break;
        System.Threading.Thread.Sleep(100);
        count++;
    }
    System.Diagnostics.Debug.WriteLine("===========================================================");
}

}

@Glority_Developer,

Thanks for using GroupDocs.Metadata for .NET. We investigated your issue, and we are unable to reproduce it at our end. Please share the API version you are using for GroupDocs.Metadata for .NET, Operating System details, development environment details, and exception message details. Furthermore please share sample files you are using so that we can further investigate your issue.

Thanks,

Thanks for looking at it. It’s not easy to reproduce in our side too, it happens for a few times.

But we find another Aspose.Imaging.dll library also has this problem. It’s a little easier to reproduce, so I have reported it to Aspose.Imaging.dll team.

You can communicate with the Aspose.Imaging.dll team and look at this problem together.

@Glority_Developer

Thanks for your response. we will discuss the issue with the concerned team and will let you know in case of any updates.

Thanks,

@Glority_Developer

As we can see that the issue has been reproduced by the Aspose team in Aspose.Imaging, however, we still need to follow the process and provide all the required details to the product team at GroupDocs. Therefore, would you please provide us the following information?

  • Version of GroupDocs.Metadata
  • Environment - x86/x64, version of Windows and .NET framework etc.

Thanks for your cooperation.

The version is 17.10.1

Windows 7 x64, .Net 4.6.1
image.jpg (61.1 KB)

@Glority_Developer

Thanks for providing details. we’ll keep you informed in case of further updates.

Thanks,

Hi @ali.ahmed,

I noticed there’s an update in GroupDocs.Metadata.
https://downloads.groupdocs.com/metadata/net/new-releases/groupdocs.metadata-for-.net-18.2(dlls-only)/

Does it fix this issue? Besides, the code freeze time of our product is the beginning of April. Do you have any idea when you will release the next version?

@Glority_Developer

Thanks for coming back. Your issue is currently not fixed. Each month we release a new version of API and we are hopeful that your issue will be fixed in upcoming releases. We are in contact with the product team and will keep you informed as soon as we get any updates from them.

Thanks,

@Glority_Developer,

The issue you found earlier (filed as METADATANET-2169) has been fixed in this update.