[Gambas-user] [SegFault 11] Enumerating HttpClient.Headers with For Each

roberto rhoct at ...325...
Sun Nov 23 23:22:54 CET 2014


Hi Benoît and All
I have a similar problem of fault segment 11 with a hpart (as MimePart) 
enumerated from a a MimeMessage
in the special condition that the part is empty, as for example ->
****************************************************************
------ = _ Part_819_1944908340.1380722116143
Content-Type: text / plain; charset = us-ascii
Content-Transfer-Encoding: 7bit


------ = _ Part_819_1944908340.1380722116143
****************************************************************
In this condition a simple
return hPart.Data
which is NULL, causes the segment fault

if it is necessary to solve the problem, I will send you a part of the 
project code

Regards


Il 23/11/2014 22:48, Benoît Minisini ha scritto:
> Le 23/11/2014 22:07, T Lee Davidson a écrit :
>> Okay, I've done more testing related to the noise I accidentally sent to
>> the list yesterday.
>>
>> Attempting to enumerate through HttpClient.Headers with For Each causes
>> a SegFault 11 under certain conditions.
>>
>> In the attached project, there is a procedure that traverses through a
>> list of three URLs from a GridView and does HttpClient.Get on each one.
>>
>> If HttpClient.Headers for each URL is enumerated with Headers[iIndex], I
>> can run through the list of URLs multiple times all day long. But, if I
>> enumerate the Headers array with For Each, the application SegFaults at
>> the second execution of the procedure.
>>
>> When using Headers[iIndex], Headers.Count is correct.
>>
>> But, when using For Each, URL[1].Headers.Count is obviously
>> URL[0].Headers.Count plus URL[1].Headers.Count. And, actually printing
>> out the headers shows that URL[1].Headers is the URL[0].Headers with
>> URL[1].Headers appended.
>>
>> Interestingly, the Headers for the third URL are correct no matter which
>> enumeration method is used. And, the application does not SegFault when
>> attempting to enumerate the Headers (with For Each) for the third URL on
>> the first run. Only after the procedure is re-entered the second time
>> does the app SegFault.
>>
>>
>> How to reproduce:
>>
>> Set "Actually Print Headers to Console" to your preference.
>>
>> A.
>> 1. Leave "Enumerate Response Headers With" set to "Headers[iIndex]".
>> 2. Click "Get Response Status Codes" as many times as you wish to show
>> that enumerating with Headers[iIndex] does not SegFault.
>>
>> B.
>> 1. Set "Enumerate Response Headers With" to "For Each Headers".
>> 2. Click "Get Response Status Codes" twice. (>>SegFault)
>>
>>
>> One last note: I stumbled across this while trying to determine why
>> HttpClient.Code sometimes returned "0", and IIRC, I was enumerating with
>> For Each at the time.
>>
>>
>> Now just for clarification, is enumerating HttpClient.Headers with For
>> Each something I should not be doing? Have I done something else wrong?
>> Or is this actually a bug?
>>
> I will look at it.
>
> But if you have a segfault, this is a bug, whatever the reason. You are
> not doing anything wrong, the interpret should never crash, only raising
> errors.
>
> If the crash is a library bug, I can't do nothing, but it seems to not
> be the case there.
>
> Regards,
>





More information about the User mailing list