Re: GraphicsMagick may collapse when binding into a server
Feng Liyuan <[email protected]> Mon, 20 May 2013 13:28:45 +0800
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <CAL6niPUT8zLQPtozshkZEYU0f5fAjWbJzio8oGwjj0dFcBeNyA@mail.gmail.com> |
I've tried both two solution.
One is:
#include <magick/api.h>
>
> static int GMCmd(int argc, char **argv) {
> int status;
> status = GMCommand(argc, argv);
> return status;
> }
>
> static void init() {
> InitializeMagick(NULL);
> }
>
and let server call init() when it starts.
The other is:
static int GMCmd(int argc, char **argv) {
> int status;
>
InitializeMagick(*argv);
>
status = GMCommand(argc, argv);
> return status;
> }
>
Then I run a pressure test code to request the server and after a while it
still broke down with message:
> magick/semaphore.c:531: LockSemaphoreInfo: Assertion `semaphore_info !=
> (SemaphoreInfo *) ((void *)0)' failed.
>
On Mon, May 20, 2013 at 11:08 AM, Feng Liyuan <[email protected]>wrote:
> Thanks for your help.
>
> If I want to `invoking InitializeMagick() once`, did it mean
> `InitializeMagick(NULL)` because I canot find `InitializeMagick()`?
>
>
> On Fri, May 17, 2013 at 10:12 PM, Bob Friesenhahn <
> [email protected]> wrote:
>
>> On Fri, 17 May 2013, Feng Liyuan wrote:
>>
>> I bind these code into a golang server to deal with images.
>>>
>>> #cgo pkg-config: GraphicsMagick
>>>
>>> #include <magick/api.h>
>>>
>>> static int GMCmd(int argc, char **argv) {
>>> int status;
>>> status = GMCommand(argc, argv);
>>> return status;
>>> }
>>>
>>>
>>> It may collapse and let server panic.
>>>
>>
>> I am not sure how a server might panic. At any rate, the solution is
>> simple.
>>
>> Add
>>
>> InitializeMagick(*argv);
>>
>> after the
>>
>> int status;
>>
>> And all should be well. In fact it should be better since after invoking
>> InitializeMagick() once, all of GM's internal semaphores are fully
>> initialized and so you can safely invoke GMCommand() in a threaded context
>> without fear of any race condition.
>>
>> Bob
>> --
>> Bob Friesenhahn
>> [email protected], http://www.simplesystems.org/**
>> users/bfriesen/ <http://www.simplesystems.org/users/bfriesen/>
>> GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
>
>
>
>
> --
> 冯立元
>
--
冯立元
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Graphicsmagick-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs