1 2 Previous Next 21 Replies Latest reply on Jun 19, 2015 1:42 AM by rrrichie

    close curl processes on FMServer

    rrrichie

      I'm using curl via the Base Element Plugin using the BE_ExecuteSystemCommand or the BE_HTTP functions. Scripts are running scheduled on FM Server. I am seeing a lot of curl  processes remaining open (terminal command ps -ax | grep curl gives 105 running processes).

       

      I know FileMaker uses curl as well, and wondering is this is a normal number or if my scheduled scripts are keeping curl sessions open (which curl does to try to reuse them)

        • 1. Re: close curl processes on FMServer
          mikebeargie

          are you using curl_close(); at the end of your script to close the session?

           

          "I know FileMaker uses curl as well", not quite sure what you mean by that.

          • 2. Re: close curl processes on FMServer
            monkeybreadsoftware

            MBS Plugin also has CURL built in.

             

            And I would always prefer to use it in the plugin over calling a command line...

            • 3. Re: close curl processes on FMServer
              nicolai

              Christian Schmitz wrote:


              And I would always prefer to use it in the plugin over calling a command line...

               

              What is the advantage of using the plugin as opposite of invoking terminal through AppleScript?

               

              rrrichie wrote:

              I'm using curl via the Base Element Plugin

              Any reason you are not using "Insert from URL" which is server compatible? 

              • 4. Re: close curl processes on FMServer
                nickorr

                What are you doing via BE_ExecuteSystemCommand?  I would guess that whatever process you're launching from there isn't completing, and is stuck.

                 

                You can probably do what you want via the HTTP functions in the plugin instead.

                 

                Cheers,

                Nick

                • 5. Re: close curl processes on FMServer
                  rrrichie

                  nicolai Any reason you are not using "Insert from URL" which is server compatible?

                   

                  Mindset of the time :-) Certificates and private keys.  I use scp with private keys for some communication to third party.   I was really into the command line and using curl was a natural progression.  On this server batches of files get scp'ed to and from and the script also handles deleting handled files.

                  • 6. Re: close curl processes on FMServer
                    nicolai

                    rrrichie wrote: 

                     

                    the script also handles deleting handled files

                     

                    Thanks for the tip, rrrichie,

                     

                    I use curl a lot, but I did not realise it can send delete requests for the the files as well.

                    • 7. Re: close curl processes on FMServer
                      rrrichie

                      you're welcome :-)   Actually I use a bash script now with some additional error checking of the response before actually deleting the file.


                      sometimes the really cool curl stuff doesn't work, cause the ftp server for e.g. is a windows machine pretending to be a unix/linus ftp server.

                      • 8. Re: close curl processes on FMServer
                        rrrichie

                        I'm using the BE_executesystemcommand in this case with a single curl call, it should close after the curl was successful, at least that's the way I understood it from the man pages.

                         

                        I've added the -m option to the curl calls now, see how that goes.

                         

                        FileMaker (as most programs I guess) use curl calls when communicating over the internet... But I don't think FileMaker Server would spawn a separate process... I'm just wondering also if other people with fmserver see a lot of curl process. 

                         

                        If i do a sudo ps -ax | grep curl, I get 106 curl processe....

                        • 9. Re: close curl processes on FMServer
                          rrrichie

                          Thanks Nicholas , that not completing... gave me a path to check out...

                          • 10. Re: close curl processes on FMServer
                            nicolai
                            a windows machine pretending to be a unix/linus ftp server.

                             

                            Sounds fun. I would use "ftp" through terminal instead and standard Windows ftp on the server. This is comes as standard as part of the OS for Windows and Mac. Works well for straight-forward setup.

                            • 11. Re: close curl processes on FMServer
                              rrrichie

                              For future reference, in case anyone is interested...

                               

                              I did a list of the status of the processes and they are all zombies.

                              ps -A -ostat,pid,ppid,command,lstart | grep curl

                              ...

                              Z    64819   195 (curl)           Thu Mar 26 04:14:18 2015   

                              Z    64823   195 (curl)           Thu Mar 26 04:14:24 2015   

                              Z    64824   195 (curl)           Thu Mar 26 04:14:25 2015   

                              Z    64828   195 (curl)           Thu Mar 26 04:14:31 2015   

                              Z    64832   195 (curl)           Thu Mar 26 04:14:33 2015

                              ...

                              195 (the parent process is

                              502   195    80   0 16Mar15 ??       1638:32.59 /Library/FileMaker Server/Database Server/bin/fmsased


                              Meaning some server side script has caused this, there are 106 curl processes, but only 4 different dates.  With the start time I was able to find the script causing this. The script runs every night so the cause is not the "normal" operation but when something goes wrong.   This script connects to a online financial package, maybe the "zombie" days where days they where down for maintenance.


                              Anyhow, since they are zombies it's ok I'll just lett them hang around, but I haven't found the real cause. 


                              I have added a -m 300 (max run time / seconds) to the curl command, wonder if that takes care of it :-)


                              Special thanks to @Nicholas Orr for setting me on the search path :-)

                              • 12. Re: close curl processes on FMServer
                                nicolai

                                You can kill those zombies.

                                 

                                kill pid

                                 

                                or killall curl

                                • 13. Re: close curl processes on FMServer
                                  rrrichie

                                  nope :-(

                                   

                                  su root then kill -9 pid doesn't even do it.

                                   

                                  Reason is process is "killed" already, it is a zombie.  You need to kill the parent proces, which I'll do tonite... when nobody is looking... trying to avoid jail

                                  • 14. Re: close curl processes on FMServer
                                    nicolai

                                    You can't go to jail for killing zombies!

                                     

                                    Check killall, I thought it should kill the parent process as well.

                                    1 2 Previous Next