problem during executing MagickWand resize method parallel (MultiThread)

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

Written a c program for image resize with MagickWand and called that c program from java (with the help JNA) and called that c program with multi thread concept

problem : image resize is not working & unable to call the c program parallely

How to call the resize c program parallely
Last edited by ArunKumar on 2020-03-19T04:31:17-07:00, edited 1 time in total.

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by magick »

The problem must lie within Java. You should be able to create threads in Java and run any command-line utility in parallel. We can help you with ImageMagick, as expected, but not Java.

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

java: MagickCore/magick.c:1038: GetMagickUseExtension: Assertion `magick_info->signature == MagickCoreSignature' failed

But It give error like this When I compiled and run the program(SomeTimes it Execute without error )

why?

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

java: MagickCore/magick.c:450: GetMagickDecoderThreadSupport: Assertion `magick_info->signature == MagickCoreSignature' failed.
java: MagickCore/magick.c:546: GetMagickEncoderThreadSupport: Assertion `magick_info->signature == MagickCoreSignature' failed.
java: MagickCore/semaphore.c:451: UnlockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) NULL' failed

Aborted (core dumped)

This is error occured when I executed it another time

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by magick »

We need to reproduce the problem before we can offer any assistance. Detail the steps required to build and run your Java script.

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

Im Using MagickWand (c Language) for image resize ( MagickResizeImage() ) & Im calling this C program from java Language(using JNA) with MultiThread concept (to perform more resize operation parallely )

Help Me...

Steps:
C Program (using MagickWand MagickResizeImage())
Calling C Program From Java ( using Java Native Access )with multiThread concept

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by magick »

Your response does not help us reproduce the problem. We would require the C program, the Java program, and dependent image/data files, plus steps to reproduce. Once we can reproduce the problem, we can trace execution to determine if the problem is within ImageMagick or your Java program. Unless its a bug in ImageMagick, we cannot help you.

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

How To send a Zip File or Files of my Code Here

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by snibgo »

Upload it to anywhere on the internet and paste the URL here.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by fmw42 »

If you only have code, you can past that between <code>...</code> tags by clicking the button marked </> after highlighting your code or click it first and paste between the tags.

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

------My Full Code-------
Last edited by ArunKumar on 2020-04-28T02:09:40-07:00, edited 2 times in total.

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by magick »

Comment out MagickWandTerminus() in resize.c. Your program will complete without complaint. Do not call MagickWandTerminus() while threads are active. Wait until all threads have completed before you call MagickWandTerminus().

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

Can you elaborate Why should I comment the MagickWandTerminus() in resize.c while threads are active and why its causing problem to the thread?

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by magick »

All calls to MagickWand, except MagickWandGenesis()/MagickWandTerminus() are thread safe. This is a standard pattern in programming:
  1. Initialize the environment
  2. spawn multiple threads
  3. wait for the threads to reap
  4. terminate the environment.

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: problem during executing MagickWand resize method parallel (MultiThread)

Post by ArunKumar »

Shall I take it in a way that not using MagickWandGenesis()/MagickWandTerminus() in a MulthiThread based program will not cause any issue or problem in now & further

Locked