Re: [squid-users] Need help to build my own external help

From: Mohamed Amine Kadimi <amine.kadimi_at_gmail.com>
Date: Mon, 16 Apr 2012 15:42:44 +0000

Hi,

I reduced my program to that:

##########
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_INPUT 8192
int main(int argc, char **argv)
{
   char request [MAX_INPUT];
   while (fgets(request, MAX_INPUT , stdin) != NULL)
   {
       printf ("OK\n");
   }
   return 0;
}

##########

But, I still get the same problem,

2012/4/12 Mohamed Amine Kadimi <amine.kadimi_at_gmail.com>:
> Problem solved partially by moving the executable to /var/lib/squid. I
> no longer get the errors in cache.log.
>
> however the browser and squidclient are unable to get a page from
> internet, they are trying to infinity and there is no error reported.
>
> 2012/4/12 Mohamed Amine Kadimi <amine.kadimi_at_gmail.com>:
>> 2012/4/11 Amos Jeffries <squid3_at_treenet.co.nz>:
>>> On 12.04.2012 06:12, Mohamed Amine Kadimi wrote:
>>>>
>>>> 2012/4/10 Amos Jeffries <squid3_at_treenet.co.nz>:
>>>>>
>>>>> On 11.04.2012 03:27, Mohamed Amine Kadimi wrote:
>>>>>>
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying to make an external helper which will be called by an acl,
>>>>>> so I have created one which is very simple: it takes an IP in stdin
>>>>>> and returns OK if it maches a predefined IP.
>>>>>>
>>>>>> It works when I test it from the CLI, however when I put the relevant
>>>>>> directives in the squid.conf file and restart squid the connection to
>>>>>> internet is no longer possible.
>>>>>>
>>>>>> The message displayed by FF is : "Firefox is configured to use a proxy
>>>>>> server that is refusing connections".
>>>>>
>>>>>
>>>>>
>>>>> It would seem Squid is not listening on the IP:port which Firefox is
>>>>> trying
>>>>> to use, or a firewall is actively rejecting port 3128 TCP connections.
>>>>>
>>>>> 1) check that squid is running okay. It should be fine if your helper
>>>>> runs
>>>>> okay on command line, but read+execute access permission differences
>>>>> between
>>>>> the squids user and your own user account can still cause problems. Run
>>>>> "squid -k parse" or look in cache.log for message if Squid is not
>>>>> starting.
>>>>>
>>>>> 2) check that port 3128 is accessible. telnet etc can be used here. A
>>>>> packet
>>>>> dump may be needed to find which device is rejecting TCP packets to port
>>>>> 3128.
>>>>>
>>>>
>>>> It's not a connectivity issue since Squid is working fine unless I
>>>> uncomment the lines relevant to my external helper.
>>>>
>>>> I noticed some errors I didn't understand in the cache.log:
>>>>
>>>> #######
>>>> 2012/04/11 17:56:19| Accepting  HTTP connections at [::]:3128, FD 24.
>>>> 2012/04/11 17:56:19| HTCP Disabled.
>>>> 2012/04/11 17:56:19| Squid modules loaded: 0
>>>> 2012/04/11 17:56:19| Adaptation support is off.
>>>> 2012/04/11 17:56:19| Ready to serve requests.
>>>> 2012/04/11 17:56:19| WARNING: src_ip_ext #1 (FD 10) exited
>>>> 2012/04/11 17:56:19| WARNING: src_ip_ext #4 (FD 16) exited
>>>> 2012/04/11 17:56:19| WARNING: src_ip_ext #2 (FD 12) exited
>>>> 2012/04/11 17:56:19| WARNING: src_ip_ext #3 (FD 14) exited
>>>
>>>
>>> These causing ....
>>>
>>>
>>>> 2012/04/11 17:56:19| Too few src_ip_ext processes are running
>>>> 2012/04/11 17:56:19| storeDirWriteCleanLogs: Starting...
>>>> 2012/04/11 17:56:19|   Finished.  Wrote 0 entries.
>>>> 2012/04/11 17:56:19|   Took 0.00 seconds (  0.00 entries/sec).
>>>> FATAL: The src_ip_ext helpers are crashing too rapidly, need help!
>>>
>>>
>>> ... this ...
>>>
>>>
>>>>
>>>> Squid Cache (Version 3.1.6): Terminated abnormally.
>>>
>>>
>>> ... resulting in the proxy being shutdown. ie (1).
>>>
>>>
>>>> #######
>>>>
>>>> I think I'll need to review my program.
>>>
>>>
>>> Hmm. The only thing that looks like it might cause issues is fopen() for the
>>> debug log.
>>>
>>
>> I've rewritten the source code excluding fopen() and handling
>> concurrency but I still get the same problem.
>>
>> Here's the new one:
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <string.h>
>>
>> #define MAX_INPUT 8192
>>
>> int main(int argc, char **argv)
>> {
>>    char request [MAX_INPUT];
>>
>>    while (fgets(request, MAX_INPUT , stdin) != NULL)
>>    {
>>        const char *channel_id = strtok(request, " ");
>>        char *detail = strtok(NULL, "\n");
>>
>>        if (detail == NULL)
>>        {
>> // Only 1 paramater supplied. We are expecting at least 2 (including
>> the channel ID)
>>            fprintf(stderr, "FATAL: %s is concurrent and requires the
>> concurrency option to be specified.\n", program_name);
>>            exit(1);
>>        }
>>
>>        if (strcmp(detail,"172.30.30.1")==0) printf ("%s OK\n",channel_id);
>>        else printf ("%s ERR\n",channel_id);
>>    }
>>    return 0;
>> }
>
>
>
> --
> Mohamed Amine Kadimi
>
> Tél     : +212 (0) 675 72 36 45

-- 
Mohamed Amine Kadimi
Tél     : +212 (0) 675 72 36 45
Received on Mon Apr 16 2012 - 15:42:52 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 17 2012 - 12:00:03 MDT