Torben Nehmer | 1 Sep 10:06
Gravatar

Re: Segfaults


Hi Piotras,

--On 2004-09-01 00:23 +0200 Piotras wrote:

> The source of last reported segfaults ( and more not reported yet )
> is zend_register_list_destructors_ex called in PHP_MINIT_FUNCTION.
> 
> static void _midgard_list_fetch_dtor(zend_rsrc_list_entry * rsrc)
> {
>    midgard_res * res = (midgard_res*)rsrc->ptr;
>    // here we get random garbage from Zend  (perk...e!)
>    if (res != NULL) mgd_release(res);
> }
> 
> Looks like rscr struct passess some garbage which is not NULL so there
> is no easy way to check it in mgd_release or even earlier.
> If someone may confirm , please report. If this is true , we have
> quite huge work to do.

Some more things I was able to narrow it on:

It definitly is no specific Midgard Call that causes the segfault.
Instead, I'm 99% certain, that the Midgard request we are talking about
is actually processed up to its end.

What all requests I observed this morning had in common is this:

1. The request is processed
2. Everything looks fine until the last line I have, which is a debug
(Continue reading)

Piotras | 1 Sep 10:23

Re: Segfaults

Torben Nehmer <torben@...> wrote:

> Some more things I was able to narrow it on:
> 
> It definitly is no specific Midgard Call that causes the segfault.
> Instead, I'm 99% certain, that the Midgard request we are talking about
> is actually processed up to its end.

Yep, it is Zend random garbage. If you search with google for mysql_free_result
you will get almost PHP|Zend related results with zend request destructor.

> What all requests I observed this morning had in common is this:
> 
> 1. The request is processed
> 2. Everything looks fine until the last line I have, which is a debug
>    statment that safly makes it into the debug log (it is fclosed every
>    time).
> 3. Then PHP Execution ends, and Midgard segfaults
> 
> It makes no difference if I exit using exit() or if I just reach the
> end of the code.

Whatever you do , you call _midgard_list_fetch_dtor.

 
> I think (can't prove though) that all requests were working extensivly
> with mgd_auth_midgard() and mgd_unsetuid() in different constellations.

If there could be some function like istype(MYSQL_RES) , we could be safe.

(Continue reading)

Henri Bergius | 2 Sep 09:26
Favicon
Gravatar

midgard-apache1 compile warnings

Greetings!

We're trying to set up NTLM authentication with Midgard 1.6.0beta for one of 
our clients. Now we're at status where winbindd authenticates but apparently IE 
(or Midgard) loses the correct state in the three-step authentication.

Winbindd run on -d3 -i reports:
pam auth crap domain: AD user: <username>

However, IE simply pops up the three field (username, password, domain) 
authentication dialogue.

In Apache error log there are some messages, including:
libsmb/ntlmssp.c:ntlmssp_update(252)
  got NTLMSSP command 1, expected 3
Midgard: no basic auth found, trying cookie auth
Midgard: domain '<username>' isn't mapped to sitegroup, denying.

Weird?

Anyway, this might be related to the fact that recompiling midgard-apache1 
gives the following warnings:

midgard-apache1.c: In function `verify_user':
midgard-apache1.c:118: warning: long int format, int arg (arg 7)
midgard-apache1.c: In function `midgard_child_init':
midgard-apache1.c:187: warning: unused variable `scfg'
midgard-apache1.c: In function `midgard_authenticate':
midgard-apache1.c:1012: warning: unused variable `password'
midgard-apache1.c:1013: warning: unused variable `auth_resp'
(Continue reading)

Piotras | 2 Sep 16:33

Re: Segfaults

Hi all!

I was talking this morning with Torben on IRC channel about fix for random segfaults.
As I wrote segfault is "produced" with  _midgard_list_fetch_dtor function registered 
as midgard resources destructor function.

Midgard itself has two types of Mysql resources:
1. persistent one - like MySQL DB connection 
2. temporary one - used for all SQL statements like SELECT, UPDATE etc.

As I understood from docs http://ific.uv.es/informatica/manuales/php/zend.variables.resource.html
registering such function is important when extension must free resources ( any type of them ) 
when these are no longer needed and used.

Midgard itself takes care about MYSQL resources , and free them when they are no needed or just been 
already used. I think we have some few exceptions here which makes these magic segfaults so random.
These segfaults are not related directly to mgd_auth_midgard or mgd_unsetuid. 

What I found on my box is that removing mgd_release from _midgard_list_fetch_dtor, made my midgard 
installation free of segfaults. Even these which sould be reproduced in 99% with particular PHP code
and with midgard registration component. However it seems like needed fix , I am not sure how it could 
work on real production server. One thing which may happen here is memory leak or increased mysql 
resources , not already freed. _May happen_ as may happen as random as these segfaults. 
If someone may confirm my theory either from practice or from sources , please write. 

Midgard PHP extension has some lost mgd_release call or we register destructor without any need to use it.

Piotras
Torben Nehmer | 3 Sep 12:28
Gravatar

www.midgard-project.org


Hi,

--On 2004-09-03 11:14 +0200 Andreas Alvarez wrote:

>> Any news when the midgard-project.org website will be back up again?
> Well, apparently "only" parts of the page are offline, as I was able 
> to open http://www.midgard-project.org/projects.
> Hmmm.

However these errors are generated, I won't have the time to look into
this before my vacation, so I turned caching off for now, which seems
to fix it.

Could please somebody try to test this, without waiting for me
returning? Turning caching off puts quite a load on Nathan, and the
sooner we get the cache back running, the better.

Nathan should be able to handle this load, but I don't want to take any
chances while I'm on vacation, as there are some other people (and
customers) that rely on this system.

Thanks.

Live long and prosper!
Torben Nehmer

--
Torben Nehmer, Guenzburg, Bavaria, Germany
http://www.nathan-syntronics.de, mailto:torben@...
(Continue reading)

Picon

www.midgard-project.org

Seems to all be working fine again :-)

Cheers

Mike.

-----Original Message-----
From: Torben Nehmer [mailto:torben@...]
Sent: 03 September 2004 11:29
To: Midgard Development
Subject: [midgard-dev] Re: [midgard-user] www.midgard-project.org

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

- --On 2004-09-03 11:14 +0200 Andreas Alvarez wrote:

>> Any news when the midgard-project.org website will be back up again?
> Well, apparently "only" parts of the page are offline, as I was able 
> to open http://www.midgard-project.org/projects.
> Hmmm.

However these errors are generated, I won't have the time to look into
this before my vacation, so I turned caching off for now, which seems
to fix it.

Could please somebody try to test this, without waiting for me
returning? Turning caching off puts quite a load on Nathan, and the
(Continue reading)

Marcin So³tysiak | 7 Sep 13:40
Picon
Gravatar

Feature request: mgd_create_thumbnail()

Hi,

I was working on HTMLArea to Aegir with images management I was thinking of
some attachment manipulation and thaught that it could be nice feature to
have a function to create a thumbnail from image attachment. It could do the
following:

object mgd_create_thumbnail(int attid,[[int size_x], int size_y]) or its OOP
representation

attid - original attachemnt id
size_x - desired X dimension. If ommited a default set
size_y - desired Y dimension. If ommited a default set

If there is only one of size_x and size_y thumbnail will constrain
porportion respectively. Returne object will inherit name with
_{sixe_x}x{size_y} added to basename.

As only midgard library knows where the original file lives on filesystem it
is only resonable place to acess directly to a file with a tool like
ImageMagick (which would be the requirement for this feature).

All could go that way:

1. Midgard checks if original attachment has one of image/(gif|jpg|jpeg|png)
mime type. If not return MGD_ERR
2. Midgard perfoms "/usr/bin/convert -geometry {sixe_x}x{size_y}
original_file temporary_file" or similar via library call
3. Creates new attachemnt named {original_name}_{sixe_x}x{size_y}
4. Copy {temporary_file} to BLOBDIR according to location field of a new
(Continue reading)

Henri Bergius | 7 Sep 13:46
Picon
Picon
Favicon
Gravatar

Re: Feature request: mgd_create_thumbnail()

Marcin SoXtysiak wrote:
> I was working on HTMLArea to Aegir with images management I was thinking of
> some attachment manipulation and thaught that it could be nice feature to
> have a function to create a thumbnail from image attachment. 

You might like to take a look at
http://midcom.tigris.org/issues/show_bug.cgi?id=94
https://sourceforge.net/projects/imgmngedt/

/Bergie

--

-- 
-- Henri Bergius -- +358 40 525 1334 -- henri.bergius@... --
     http://bergie.iki.fi --- http://www.midgard-project.org
         http://www.oscom.org --- http://www.routamc.org
Marcin Soltysiak | 7 Sep 13:53
Picon
Gravatar

Re: Feature request: mgd_create_thumbnail()


----- Original Message ----- 
From: "Henri Bergius" <henri.bergius@...>
> Marcin SoXtysiak wrote:
> > I was working on HTMLArea to Aegir with images management I was thinking
of
> > some attachment manipulation and thaught that it could be nice feature
to
> > have a function to create a thumbnail from image attachment.
>
> You might like to take a look at
> http://midcom.tigris.org/issues/show_bug.cgi?id=94
> https://sourceforge.net/projects/imgmngedt/

That's what I used :)But there is a pitfal: when you create a new attachment
it is easy since you first have it in a plain filesystem. If the attachment
already exists same operation would require:

1. OPen attachment
2. read attachemnt
3. write it to temp file
4. convert temp file
5. create new attachemnt
6. copy converted temp file

and all of it made in PHP :-) I suggest to move it to library using
ImageMagick via library calls

Solt
(Continue reading)

Piotras | 7 Sep 14:11

Re: Feature request: mgd_create_thumbnail()

"Marcin Sołtysiak" <olga@...> wrote:

> Hi,
> 
> I was working on HTMLArea to Aegir with images management I was thinking of
> some attachment manipulation and thaught that it could be nice feature to
> have a function to create a thumbnail from image attachment. It could do the
> following:

I thought about resize() method for attachments. And imagemagick library.

Piotras

Gmane