Author Topic: Flight Not Logged, but pilot/plane location changed  (Read 4505 times)

OAV001

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Open Air Virtual
Re: Flight Not Logged, but pilot/plane location changed
« Reply #30 on: October 10, 2017, 09:52:32 AM »
Did you do what Alejandro (VAM) suggested? And does the problem still occur?

Cheers,

Peter Faase
CEO / Webmaster Open Air Virtual
http://www.openairvirtual.eu

justme1003

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #31 on: October 10, 2017, 06:13:35 PM »
Did you do what Alejandro (VAM) suggested? And does the problem still occur?
I think I have done everything that this forum has suggested. What was his post ?

adanesh

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #32 on: March 11, 2018, 02:45:09 PM »
Hi ...

It has been a while since I have seen activity on this thread. I am now seeing this problem in a VA I am helping launch. None of the suggestions in this thread have helped. We are running VAM 2.6.2 on a current LAMP stack with SimAcars 1.4.0.

UPDATE SINCE ORIGINAL POST: I can see in SimAcars that Critical Events shows the following error when I try to send the flight report:

Code: [Select]
There was an error running the query [Incorrect integer value: '' for column 'landing_hdg' at row 1]
I am not 100% sure what that actually means -- any suggestions? I'm inclined to edit receivevampirep.php to exclude that field from all SQL that inserts/updates tables just to see if it helps. But, not sure the implication of doing that downstream.

Has anyone got past this problem successfully?

FURTHER UPDATE: I ended up setting $landing_hdg to 0 in receivevampirep.php just before the SQL command that uses the value. That got me further: a series of errors in Critical Events in Sim Acars like this:

Code: [Select]
There was an error running the query [Field 'virtual_airline' doesn't have a default value]
I got this for multiple fields all in the vampireps table and what I did was set default values in the MySQL table definition for those fields (default of 0 or empty string as appropriate). Not sure if this is a good idea but it does appear to have allowed a flight to file. Will now need to test this more robustly for multiple flights, etc.

Thanks.
« Last Edit: March 11, 2018, 03:20:36 PM by adanesh »

BilKapek

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • FreedomSim.tk
Re: Flight Not Logged, but pilot/plane location changed
« Reply #33 on: March 13, 2018, 09:06:58 AM »
You will get this error message when your PHP script provides a string while MySQL expects an integer.
In most cases, this message appears when your code is online because you provide MySQL with a field with letters while waiting for numbers.
However, in this case, an update of the HTTP server may raise the problem.
In fact, the problem is attributable, in this case, to empty strings: ".
If you come to "printer" your PHP query, you will discover, without doubt, that it includes:
Code: [Select]
$landing_hdg = ''

To correct this error, you can modify all your requests ...
But another much simpler and immediate way to correct this error is to modify the MySQL configuration file.
To do this, you will have to put a little "hands in the code" by making a slight modification of the file: my.ini.
find the {sql-mode} parameter to test
Code: [Select]
sql-mode="STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER"
CHANGE TO
Code: [Select]
sql-mode=""made a test, then tell me how to respond to this change
Sam.

adanesh

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #34 on: March 13, 2018, 09:50:06 PM »
Thanks for the comments. I agree the issue is the empty string vs. integer value being passed -- hence my decision to set the value to zero in receivevampirep.php.

But my bigger concern here is I haven't edited any VAM code in any file and yet this problem is happening. This strongly suggests a deeper problem in either SimAcars or VAM which leads to an empty string being passed into the SQL insert command in receivevampirep.php. I'm surprised the issue isn't pervasive for everyone.

In any case, it seems your suggestion around sql-mode -- that seems like over-kill to me: globally changing MySQL behaviour for what seems to be a very narrow code error in VAM itself.

BilKapek

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • FreedomSim.tk
Re: Flight Not Logged, but pilot/plane location changed
« Reply #35 on: March 13, 2018, 10:42:42 PM »
hi adamesh
you arouse my curiosity with this subject  ;D 
silly question
did you test set the default NULL value for the landing_hdg column in the datatable ?

update.
the value is already NULL in the column
so for me the proleme does not come from the requests
do you have access to the log of the web service


Sam.
« Last Edit: March 13, 2018, 11:06:30 PM by BilKapek »

adanesh

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #36 on: March 17, 2018, 11:02:51 AM »
BilKapek ...

Are you suggesting that I set the value to NULL in the code instead of using 0 (zero) as I described? Or, are you suggesting I set the default column value to NULL? The thing is that is exactly what the table definition in MySQL says but that doesn't work and throws SQL errors. Only by setting a non-string, non-null value for this field in PHP before the SQL insert occurs can I get the pirep to file from SimAcars.

Right now, I can get flights to file when pilots click "Send Report" in SimAcars but it creates two issues:

1 - SimAcars displays an "Error trying to send the flight data to the web", and
2 - A spinning circle appears under "Virtual Airline" in the "Virtual Airline Login" box and spins continuously and doesn't disappear until the user exist SimAcars (but this doesn't appear to prevent SimAcars from being used).

Regarding web logs, it is my server but the web server error logs show no material errors when SimAcars files flights and all requests from SimAcars seem to return a 200 OK status -- so no application errors and no 404 not found errors.

I should note that when the flight is filed, three HTTP requests appear to be logged from SimAcars. The web access logs show, these three requests:

/vam/receivevampirep.php -- returns HTTP 200 (so successful)
/vam/receivevamevents.php -- returns HTTP 200
/vam/receivevamtracks.php -- returns HTTP 200

Those requests generate no errors in the web server error logs.

Arman

adanesh

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #37 on: March 17, 2018, 11:47:24 AM »
Further to my last post, I found the following errors in the file simacarserrorlog.txt on the client:

Code: [Select]
17/03/2018 10:45:16
Input string was not in a correct format.

17/03/2018 10:45:16
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Convert.ToInt32(String value)
   at SIM_ACARS.Form1.report_flight(String flight_id)

17/03/2018 10:45:16
System.Collections.ListDictionaryInternal

These three error appear each time the user files a flight report and gets the error I described previously. The flight does file and no errors appear in the server logs. Is this useful in tracking down the cause of the error that SimAcars displays?

adanesh

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #38 on: March 17, 2018, 12:46:43 PM »
Further update: I installed Fiddler to view the actual HTTP transactions between SimAcars and the server to debug this last issue.

In the log I found that the last request I was seeing in the HTTP logs (/vam/receivevamtracks.php) was returning HTTP 200 OK but the content payload was:

Code: [Select]
There was an error running the query [Data too long for column 'plane_type' at row 1]
Further review of the data being sent revealed that the airline administrators had an incorrect aircraft ICAO ("ATR 72" instead of "AT7"). I reviewed all the ICAOs, corrected them and now the flights fully log successfully without an error in SimAcars.

Also when filing, a fourth and final request is made from the client to /vam/vam_acars_check_data.php which returns successfully.

I still need the code changes described earlier for landing_hdg (i.e. setting to 0 in the code before the insert) but that works and everything seems to be OK now.


BilKapek

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • FreedomSim.tk
Re: Flight Not Logged, but pilot/plane location changed
« Reply #39 on: March 17, 2018, 02:43:11 PM »
Hi arman
I welcome this good news

for vamacars errors have to ask Alex

I remember that one of my friends had reported me an error, when the name of the plane was very long it return an error to the sending of the report
I do not know if this can be your case?

question: in the section of the json_decode in receivevampirep.php
do you have:
Code: [Select]
$ landing_hdg = $ data [0]["landing_hdg"];
I guess if it does not exist, the error may come because the value is not decoding at the time of reading

in my opinion there is another underlying problem which one? I would not say
but I still find it strange
thank you again for this feedback
Sam

adanesh

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Flight Not Logged, but pilot/plane location changed
« Reply #40 on: March 17, 2018, 04:53:22 PM »
Sam ...

Yes -- I hadn't edited receivevampireps.php so had the following line:

Code: [Select]
$landing_hdg = $data[0]["landing_hdg"];
That's what I find so strange.

What is the impact of defaulting $landing_hdg to zero before the SQL insert? Should I be concerned?

Thanks.

Arman

BilKapek

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • FreedomSim.tk
Re: Flight Not Logged, but pilot/plane location changed
« Reply #41 on: March 17, 2018, 05:39:01 PM »
that's what I find so strange
why it's only this value that is problematic, that's what I do not understand

to assign a value before insertion will not have a significant impact
this especially allows the query not to crash if there is no value defined in the column
you can put it to '0' as you can leave it empty it can not hurt
Code: [Select]
$landing_hdg = '0';
$landing_hdg = '';

again I think the problem comes from elsewhere
have you recently had an update of your server
maybe we should look in that direction
I think we should look at the PHP and mysql versions
maybe the problem comes from there, a track to follow

Sam