The page cannot be displayed due to a gateway timeout

770 views
Skip to first unread message

denis.b...@hotmail.com

unread,
Dec 15, 2020, 4:52:18 AM12/15/20
to Softone Developers Network
Καλησπέρα όταν στέλνω αυτό το request μου επιστρέφει πολλές φορές αυτο
The page cannot be displayed due to a gateway timeout.


function call3($clientID, $reqID) {
 $curl3 = curl_init();
  curl_setopt_array($curl3, array(
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>'{"service": "getBrowserData", "clientID": "'.$clientID.'", "appId": "2001", "reqID" : "'.$reqID.'","start": "0","limit":"20000"}',
  CURLOPT_HTTPHEADER => array("Content-Type: text/plain; charset=UTF-8 "),
));
    $aresponse3 = curl_exec($curl3);
curl_close($curl3);

Μπορεί κάποιος να με βοηθήσει ώστε να μην κάνει timeout αλλα να περιμένει μέχρι να λάβει την απάντηση.

Θανάσης Στυλιανόπουλος

unread,
Dec 31, 2020, 6:59:58 AM12/31/20
to Softone Developers Network
Καλησπέρα, χρόνια πολλά και καλή χρονιά
Μπορείς να ορίσεις το time out με την παρακάτω εντολή php:
ini_set('max_execution_time', 300); //300 seconds = 5 minutes 


Εγώ χρησιμοποιώ τα παρακάτω options:
curl_setopt($ch, CURLOPT_POST      ,1);
curl_setopt($ch, CURLOPT_ENCODING ,""); // S.O.S for oncloud softone
curl_setopt($ch, CURLOPT_POSTFIELDS , $postdata );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1); // in case of redirec
curl_setopt($ch, CURLOPT_HEADER      ,0);  // DO NOT RETURN HTTP HEADERS
curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1); // RETURN THE CONTENTS OF THE CALL
curl_setopt($ch, CURLOPT_FAILONERROR, true);  // report errors back to me
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Pragma: no-cache',
'Cache-Control: no-cache',
'Connection: keep-alive',
));
$Rec_Data = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);  // elegxos gia lathi
// ---------  if ($http_status==503)
if(curl_errno($ch)) { 
.....
Γενικά μου δουλεύει μέχρι τώρα χωρίς προβλήματα.

denis.b...@hotmail.com

unread,
Jan 13, 2021, 3:02:22 AM1/13/21
to Softone Developers Network
Σε ευαριστώ πολυ..

denis.b...@hotmail.com

unread,
Jan 13, 2021, 3:03:48 AM1/13/21
to Softone Developers Network
Υπάρχει κάποις τρόπος να πιάνω τα seccess false? Δηλαδή όταν επιστέφει success false να ελέγχεται από κάποια if.

Θανάσης Στυλιανόπουλος

unread,
Jan 16, 2021, 5:36:05 AM1/16/21
to Softone Developers Network
Μετά το curl_exec,   $Rec_Data = curl_exec($ch);  ελεγχουμε το curl_errno και το Http status :
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(curl_errno($ch)) {
if( curl_errno($ch) > 0 )  {

// TO curl_errno >0 σημαίνει ERROR: Δες και https://www.php.net/manual/en/function.curl-errno.php
  
if( $http_status != 200 ) {
// http status <> 200 σημαίνει ότι δεν επεστράφει κατάλληλη απάντηση

επίσης δες και curl_getinfo ( CurlHandle $handle , int|null $option = null ) : mixed

Μην ξεχνάς, μόλις ολοκληρωθεί το response:    curl_close($ch);

Στη συνέχεια
$output = mb_convert_encoding( $Rec_Data, 'UTF-8', 'ISO-8859-7');
$obj = json_decode($output);
if( json_last_error() ==  JSON_ERROR_NONE ) 
// successfull json decoding
       //  now you can check the object $obj properties....
      // παραδειγμα,   if( $obj->sucess == 'success'  )  ......
else
  // there is a json error decoding, bad json, no json at all

dkot...@gmail.com

unread,
Jul 5, 2021, 6:12:46 AM7/5/21
to Softone Developers Network
Συγνώμη που απαντάω μετά από τόσο καιρό αλλά έπεσα στο ίδιο πρόβλημα.

Τουλάχιστον στην περίπτωση μου (και υποπτεύομαι και σε αυτή του αρχικού μηνύματος) το gateway timeout δεν το βγάζει η php αλλά τα web services της softone.

Το curl request δηλαδή παίρνει 504 response από απέναντι. Επιβεβαιωμένο με network monitor. Οπότε οσοδήποτε μεγάλο και να βάλω το δικό μου timeout δεν αλλάζει κάτι.

Αυτό που αργεί στην περίπτωση μου είναι ένα ευρετήριο ειδών με υπόλοιπα σε πολλές χιλιάδες είδη. Δεν έχω κανένα πρόβλημα να περιμένω όση ώρα χρειαστεί για να πάρω την απάντηση. Μήπως υπάρχει κανένας τρόπος να ανεβάσουμε το timeout στα webservices ;

Liviu Buligan

unread,
Mar 2, 2022, 1:13:47 PM3/2/22
to Softone Developers Network
Hello,
I have the same problem as above, I post via WS a document with 600 lines, with colors and sizes, updating backorders, etc. The post takes over a minute, and after 66-68 seconds I am getting the message "The page cannot be displayed due to a gateway timeout". The document is posted, but i never get a json with the result.
Can anyone tell us if there is any parameter that can extend this timeout period? In fashion business we need to be able to process maybe 2000 lines or more in a document. These are receptions that are posted via API from a WMS system, so we cannot avoid the situation.  To make things more difficult, the SN is hosted in Azure, so we do not have access to web.xco...

Xarilaos D

unread,
Mar 3, 2022, 4:27:35 AM3/3/22
to Softone Developers Network
Το timeout μπορεί να συμβαίνει σε πολλά σημεία.
Στην περίπτωση που έχετε response 504 από το oncloud  είναι ξεκάθαρα από εκεί.
Το oncloud από ότι έχω καταλάβει απλός κάνει προώθηση τα request στον τοπικό μας server.
Οπότε αν θα θέλετε να δείτε αν ευθύνεται το configuration στον web server στο oncloud ή από μεριάς του server σας μπορείτε να στείλετε τα request απευθείας στον server σας στην τοπική ip στην πόρτα 22099. Παράδειγμα στο http://192.168.1.ΧΧΧ:22099/s1services. Προφανώς θα πρέπει να έχετε ανοίξει την συγκεκριμένη πόρτα στο firewall στον server και να κάνετε port forward αν κάνετε τα request εκτός τοπικού δικτύου. 

Αν και στο τοπικό request κάνει timeout τότε ίσως να μπορούσε να γίνει κάτι αλλά δεν γνωρίζω πως ακριβός δουλεύει το web service τοπικά (μέσω IIS? custom?)

Αν στο τοπικό request απαντάει στο request αλλά σε χρόνο μεγαλύτερο τον 60 sec τότε προφανώς υπάρχει timeout limit στον web server στο oncloud στα 60 sec και δεν νομίζω να μπορείτε να κάνετε κάτι για αυτό. 

Αυτό που μπορούμε να βελτιώσουμε είναι το request.
Σε όλες τις περιπτώσεις τα 60sec είναι τεράστιος χρόνος. Γενικός δεν είναι αποδεκτό να γίνετε request και να μην υπάρχει απάντηση σε 1-5 sec (και πολλά λέω) οπότε στην περίπτωση του getBrowserData θα πρέπει να βελτιώσουμε τον browser. π.χ. αφήνουμε μόνο τα απαραίτητα πεδία που θέλουμε να πάρουμε, αφαιρούμε υπολογιζόμενα πεδία (μήπως είναι καλύτερα να κάνει του υπολογισμούς το script-application?) ,database optimization (είναι indexed τα πεδία που έχουμε στο query μας?).

Στην περίπτωση που δεν έχετε response τα πράγματα που θα πρέπει να κοιτάξετε (ανάλογα την γλώσσα και από που τρέχει) είναι
- το configuration της γλώσσας π.χ. στην php θα πρέπει να δούμε max execution time, max input time, max input vars και άλλα πολλά.
- αν κάνουμε χρήση κάποιου library - web client π.χ. curl θα πρέπει να δούμε το timeout που έχουμε εκεί.
- αν καλούμε το script μας μέσω http request θα πρέπει να δούμε το timeout και εκεί (π.χ. apache)
Πάντα το error log (php error log, apache error log) θα μας κατατόπιση.

Liviu Buligan

unread,
Mar 3, 2022, 2:20:03 PM3/3/22
to so...@googlegroups.com
Thank you very much for your answer. 
I can assure you that there are not many optimizations to perform. 60sec is not at all a huge time since saving a document in Soft1that have many item lines (600+ items with attributes ) is taking much more than a minute. I have to mention that the document is saved, but the result (containing the ID ) is not available, the response is replaced with the Gateway timeout message.  
I have expanded the lines to over 1200 items, and the document is still saved, after 5-6 minutes. So the Soft1 app server is playing very well, but the web service doesn't have the patience to wait for the id to return it back to the client.
We have performed extensive tests with various posting methods (setData, JS) and clients (Php, Postman) all of them showing the same behavior. Since the installation is in the cloud we do not have many options, so all that we hope is a reply from Softone core developers.

Liviu

--
Softone Developers Network group.
To post to this group, send email to so...@googlegroups.com
---
Λάβατε αυτό το μήνυμα επειδή έχετε εγγραφεί σε ένα θέμα στην ομάδα "Softone Developers Network" στις Ομάδες Google.
Για να απεγγραφείτε απ' αυτό το θέμα, επισκεφτείτε τη διεύθυνση https://groups.google.com/d/topic/soft1/BGvWnodmSDA/unsubscribe.
Για να απεγγραφείτε απ' αυτή την ομάδα και όλα τα θέματά της, στείλτε ένα μήνυμα ηλεκτρονικού ταχυδρομείου στη διεύθυνση soft1+un...@googlegroups.com.
Για να κάνετε προβολή αυτής της συζήτησης στον ιστό, επισκεφτείτε τη διεύθυνση https://groups.google.com/d/msgid/soft1/6a11005a-8a3d-440c-a377-1337e9193378n%40googlegroups.com.


--
Liviu Buligan

Νίκος Μάλιακκας

unread,
Mar 5, 2022, 6:32:22 AM3/5/22
to Softone Developers Network
Softone itself breaks any document it produces by itself at 500 lines. (you can check it when making documents of fixing the items count per warehouse)
Nowdays I use javascript functions to import documents instead of sbsl, and yes it is slower.
Last year it took 1 hole day to import a 30000 line document.

The first 1000 lines are quick, but after that every new line takes more time to process than the previus one.

I also used ModuleIntf.SetDatasetLinks to speed up the process, but only by a small decrease of time.

This year I also splited the documents by items category, and users were happy because they loaded and edited faster
Biggest document was 6400 lines long and took more than half hour to produce.

If as you say the document is stored at the end (something that is not quaranteed while using WebPort instead of Open Enterprise engine), even if the process on your side terminates with timeout, then consider sending a GUID somewhere in the document and recheck after a while if the GUID exists with a separate call. 

Liviu Buligan

unread,
Mar 5, 2022, 1:48:42 PM3/5/22
to Softone Developers Network
Hi Nikos, thank you for your answer. It is clear that SBSL should be faster. I did not want to change to SBSL because i should change all the synchronisation principles, and i discovered the problem when we just went live with the integration with the WMS system.
I do not have so huge documents like you, the smallest one was 650 lines and took 2 minutes to save (as reported by the web service trace monitor). I decide also to split the documents at 300 lines. 
I was thinking that the WS timeout could be a parameter and not a fixed value. In MSSQL you can set the query time-out, in PHP you can set the timeout in the php.ini file or on the script level, I assume all web communication have such parameters that could be set somehow... I was thinking that we also could have a parameter that will allow some long-running processes to end and return results. My case is on the cloud, so any parametrisation of the agent or fine-tuning of the database is not in our hands. 
For now, i have no other option but to split the documents and check if they were saved properly.
Still, an annoying problem remains, In case the document is not posted, I have no idea what is the reason - could be a missing of a mandatory field, an out-of-stock situation, or any other error raised by the application logic. 
I have seen a post of Mr. Giorgoulakis on this subject as well, but to me, it sounds he is referring to on-premise installations (if I understood correctly). Besides this, he did not mention that the 60 seconds threshold can be changed, so we should consider this as a fixed value, no matter if you run on-premise or on-cloud. :(
Reply all
Reply to author
Forward
0 new messages