10 Replies Latest reply on Dec 12, 2013 3:56 AM by danmarks

    PHP CWP Error Code 101 - Record Is Missing

    danmarks

      Summary

      PHP CWP Error Code 101 - Record Is Missing

      Product

      FileMaker Server

      Version

      12

      Operating system version

      Windows Server 2008R2

      Description of the issue

      A PHP script runs every 2 minutes to look at a table in my database called SMS. If it finds any records it grabs them, sends the SMS (via a different API) then edits the record and marks them as sent.

      This generally works fine, sending 100s a day. However, every couple of months it crashes. It grabs a record from the table, sends the SMS, but when it goes to update the record the script exits with error 101 Record Is Missing. My logs show that it tried to use the correct record id to update the record.

      Once I had manually marked the record as sent, it continued to send and mark the others fine.

      Here is the code;


                   #create the find command and specify the layout
              $findCommand =& $fm->newFindCommand('CWPSMS');

              #Specify the field and value to match against.
              $findCommand->addFindCriterion('status', "Queued");



              #Perform the find
              $result = $findCommand->execute();
                        #Store the matching record

                     foreach ($records as $record) {
           $recordID=$record->getRecordId();


                          // Get records from found set

                     $records = $result->getRecords();

      //text api

      $respondent_data = array(
                                                  'sent_time'            => $time,
                                                             'sms_status'            => $sms_status,
                                                             'sms_msgid'            => $sms_msgid,
                                                             'sms_schid'            => $sms_schid,
                                                             'status'               => 'PENDING'
                                              );


               $newEdit =& $fm->newEditCommand('CWPSMS', $recordID, $respondent_data);
                $result = $newEdit->execute();
      }

      Steps to reproduce the problem

      The script ran 5 times, and produced the same error with the same record.

      Expected result

      The script to update the record.

      Actual result

      Returned error 101 Record is missing

      Exact text of any error message(s) that appear

      101 Record is missing

        • 1. Re: PHP CWP Error Code 101 - Record Is Missing
          TSGal

               Dan Marks:

               Thank you for your post.

               Since this fails with the same record each time, is there anything out of the ordinary with that record?

               Try placing some results into another field(s) in another table.  That is, if the record is found, capture the record ID, and write it to a text field in another table.  Then come back to the original file and continue with the script.  If the case fails, then you have the record ID that was trying to be updated. 

               Since you tried executing the script five times against the same record, is it just this specific record that has an issue?

               Anything else you can provide may be helpful in narrowing down possible causes.

               TSGal
               FileMaker, Inc.

          • 2. Re: PHP CWP Error Code 101 - Record Is Missing
            danmarks

                 Hi TSGal, 

                 It happened again this morning. I duplicated the record, and ran the script, it worked fine with the duplicate record. There is also no obvious link between the record that this happened with yesterday and today. It sends me an email with the record number upon error. 

                 Doesn't seem to be something I can recreate. I thought perhaps it might be a writing issue, if someone else was editing the record, but none of my users have access to this table.

                 Thanks,

                 Dan 

            • 3. Re: PHP CWP Error Code 101 - Record Is Missing
              TSGal

                   Dan Marks:

                   Thank you for the additional information.

                   These intermittent issues are also frustrating to us (but nowhere to the same degree as you) since the issue doesn't provide enough information to determine a cause.

                   Since the record in question today is not linked to the record from yesterday, are you ever able to repeat the script a second time with the same record and have it be successful?  I know you duplicated the record and ran the script again on the duplicate record.  How about running the script again on the original record?

                   If more than one record is found, do you notice if it is the first or last record that is processed that returns the "Record not found" error?

                   TSGal
                   FileMaker, Inc.

              • 4. Re: PHP CWP Error Code 101 - Record Is Missing
                danmarks

                     Hi TSGal,

                     I ran the script again with the orginal record, and the problem was replicated. 

                     This problem generally happens with the last record in the found count. 

                      

                     Thanks,
                     Dan 

                • 5. Re: PHP CWP Error Code 101 - Record Is Missing
                  TSGal

                       Dan Marks:

                       I'm still a bit confused.  You mention that it happens with a specific record, but not with a duplicate of that record.  Yet, you say it generally happens with the last record in the found set.  Yet, you originally said "every couple of months it crashes."

                       If you delete the original record and create a duplicate record (that appears to work), does the problem continue to occur?

                       Please clarify.

                       TSGal
                       FileMaker, Inc.

                  • 6. Re: PHP CWP Error Code 101 - Record Is Missing
                    danmarks

                         TSGal,

                         It doesn't happen regularly, the script runs every 2 mins and for the majority of times it works perfectly. In the last two months this has happened about three times. I have noticed, however, that when it does happen, on some occasions it is the last record in the found set. 

                         Indeed removing the problematic record, removes the problem. Yet I suspect within the next month or so a new record will experience the same problem.

                    • 7. Re: PHP CWP Error Code 101 - Record Is Missing
                      TSGal

                           Dan Marks:

                           Since this issue occurs intermittently, write down what you remember about this last record (contents, values), and when it occurs again, write down everything about that record and see if there is any similarities.  This may help to determine a possible cause.

                           TSGal
                           FileMaker, Inc.

                      • 8. Re: PHP CWP Error Code 101 - Record Is Missing
                        philmodjunk

                             You might even import that "problem" record into a separate table so that each time that it happens, you can do this and then compare records for any commonalities in what you see.

                        • 9. Re: PHP CWP Error Code 101 - Record Is Missing
                          danmarks

                               Attached are the problem records from the last month. I can't see any commonalities. I have removed the mobile to number for data protection reasons but they had no commonalities.

                          • 10. Re: PHP CWP Error Code 101 - Record Is Missing
                            danmarks

                                 Interesting to note that when I delete the PHP script, and then re upload it to the ftp server, the records that always produced that error when I ran the script, no longer do and update fine. However, the error is still produced intermittently on new records that it tries to update. I have reduced the frequency in which the script runs to 5mins to see if the script is some how running multiple instances and causing some sort of field access issue.