Recent

Author Topic: Get a SIGPIPE error using indy...  (Read 13103 times)

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Get a SIGPIPE error using indy...
« on: May 12, 2010, 07:06:36 am »
Hi all,

Lazarus 0.9.29, FPC 2.4.0, Indy 10.2.0.3.

I get a SIGPIPE and application crash with this code. Sometimes during the first call, often the second call... However, the request works : I receive the email confirmation created by the web server.
Code: [Select]
try
    ms:=TMemoryStream.Create;         
    Form1.IdHttp1.Get(gc_www, ms); // SIGPIPE !!!
    If ms.Size <> 0 Then Begin
          etc...
 

Any idea ?

Thanks,
André.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Get a SIGPIPE error using indy...
« Reply #1 on: May 12, 2010, 07:14:00 am »
It's probably related to this: http://bugs.freepascal.org/view.php?id=9401

The Indy authors probably "fixed" the problem by commenting out the use of MSG_NOSIGNAL on Mac OS X, without adding SO_NOSIGPIPE when creating the sockets.

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Get a SIGPIPE error using indy...
« Reply #2 on: May 12, 2010, 07:42:10 am »
And... How can I solve the issue ?
I've tried to put MSG_NOSIGNAL in unxsockh.inc without success.
I've tried to replace
Code: [Select]
Result := CheckForSocketError(fpsend(ASocket, @ABuffer, ABufferLength, AFlags));by
Code: [Select]
Result := CheckForSocketError(fpsend(ASocket, @ABuffer, ABufferLength, AFlags or Id_MSG_NOSIGNAL));in IdStackUnix.pas without success...

I have found some post about this subject but non solution...

André.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Get a SIGPIPE error using indy...
« Reply #3 on: May 12, 2010, 07:47:25 am »
And... How can I solve the issue ?

I don't know, I've never used Indy. You should probably file a bug report with the Indy developers about this.

Quote
I've tried to put MSG_NOSIGNAL in unxsockh.inc without success.
I've tried to replace
Code: [Select]
Result := CheckForSocketError(fpsend(ASocket, @ABuffer, ABufferLength, AFlags));by
Code: [Select]
Result := CheckForSocketError(fpsend(ASocket, @ABuffer, ABufferLength, AFlags or Id_MSG_NOSIGNAL));in IdStackUnix.pas without success...

Please read the comments to the bug report again, especially the last comment by me. MSG_NOSIGNAL is not a flag for fpsend, but for fpconnect.

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Get a SIGPIPE error using indy...
« Reply #4 on: May 12, 2010, 08:06:40 am »
I can't see any way to pass a flag to fpconnect ...

Code: [Select]
CheckForSocketError(fpConnect(ASocket, @LAddr, SizeOf(LAddr)));       

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Get a SIGPIPE error using indy...
« Reply #5 on: May 12, 2010, 08:08:22 am »
I can't see any way to pass a flag to fpconnect ...

Code: [Select]
CheckForSocketError(fpConnect(ASocket, @LAddr, SizeOf(LAddr)));       

Sorry, it's via fpsetsockopt(). See "man setsocketopt" in a Mac OS X terminal window for info on how to use it.

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Get a SIGPIPE error using indy...
« Reply #6 on: May 12, 2010, 08:50:36 am »
I'm still lost. I did not develop indy...

Does Indy work or not ? That is the question.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Get a SIGPIPE error using indy...
« Reply #7 on: May 12, 2010, 08:55:07 am »
I'm still lost. I did not develop indy...
Me neither.

Quote
Does Indy work or not ? That is the question.
It works, but has bugs just like every other piece of software in existence. As I said: file a bug report with the Indy developers.

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Get a SIGPIPE error using indy...
« Reply #8 on: May 12, 2010, 09:25:25 am »
There is already a bug report about SIGPIPE, and it is marked as resolved...

Is there any other simple way to get a http request without using Indy ?   

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Get a SIGPIPE error using indy...
« Reply #9 on: May 12, 2010, 01:18:32 pm »
Well,

I've tried to do a bug report, without success because bug reporting is now closed to public users, nice.

Anyway, I have found a workaround: I have added this code before every call to the get method, and now it works.

Code: [Select]
idHTTP1.Free; IdHTTP1 := TidHTTP.Create;
It seems that Indy does not release all ressources after a call or something like that...

Thanks,
André.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4470
  • I like bugs.
Re: Get a SIGPIPE error using indy...
« Reply #10 on: May 12, 2010, 06:23:32 pm »
I've tried to do a bug report, without success because bug reporting is now closed to public users, nice.

The bugtracker is open for anybody, I just tested it.
Just login with your user name and password.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018