Background
I have developed a python flask app that uses the ArcGIS API for JavaScript to display geospatial data and query feature services from an ArcGIS Online account. Results from these queries are saved to a MongoDB Atlas cluster.
The flask app is deployed to an Apache server running Centos8 using mod_wsgi. It is currently working on a Heroku/gunicorn deployment.
Below is the code for the app.py code for the Flask app:
from flask import Flask, render_template, request
from data.database import global_init
from data.database import Query
from data.update import update
from whitenoise import WhiteNoise
app = Flask(__name__)
app.wsgi_app = WhiteNoise(app.wsgi_app)
my_static_folders = (
'./static/css/',
'./static/images/',
'./static/js/',
'./static/layers/'
)
for static in my_static_folders:
app.wsgi_app.add_files(static)
#app.route("/query", methods=["GET", "POST"])
def query():
if request.method == 'POST':
feature = request.json
feature_name = feature['name']
feature_region = feature['region']
feature_query = Query.objects(name=feature_name, region=feature_region)
if feature_query:
response = feature_query[0].export()
else:
response = ''
return response
#app.route("/")
def home():
return render_template("index.html")
if __name__ == "__main__":
global_init()
files = ['./static/css/styles.css', './static/js/app.js']
app.run(debug=True,
extra_files=files)
Below is the wsgi.py file:
#!/usr/bin/env python
import sys
import site
site.addsitedir('/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages')
sys.path.insert(0, '/var/www/dm.nhmarchive.org/lau-map')
from app import app as application
Problem
The issue arise when the app tries connecting to the MongoDB Atlas cluster to query/retrieve data. When a polygon is clicked on the map, the connection to the cluster is refused and the following error is logged in the error.log:
[Thu Oct 21 20:19:46.800129 2021] [wsgi:error] [pid 1430689:tid 139930235827968] [client 99.8.162.56:55543] , referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471649 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] [2021-10-21 20:20:14,470] ERROR in app: Exception on /query [POST], referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471711 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] Traceback (most recent call last):, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471715 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471718 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] response = self.full_dispatch_request(), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471721 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471724 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] rv = self.handle_user_exception(e), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471727 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471729 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] reraise(exc_type, exc_value, tb), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471732 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471751 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] raise value, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471757 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471760 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] rv = self.dispatch_request(), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471762 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471765 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] return self.view_functions[rule.endpoint](**req.view_args), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471768 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/app.py", line 51, in query, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471770 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] feature_query = Query.objects(name=feature_name, region=feature_region), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471773 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/mongoengine/queryset/manager.py", line 37, in __get__, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471776 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] queryset = queryset_class(owner, owner._get_collection()), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471778 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/mongoengine/document.py", line 214, in _get_collection, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471786 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] if cls._meta.get("auto_create_index", True) and db.client.is_primary:, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471788 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1031, in is_primary, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471791 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] return self._server_property('is_writable'), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471793 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 856, in _server_property, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471796 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] writable_server_selector), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471798 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/pymongo/topology.py", line 243, in select_server, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471800 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] address)), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471803 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/pymongo/topology.py", line 200, in select_servers, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471805 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] selector, server_timeout, address), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471808 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] File "/var/www/dm.nhmarchive.org/lau-map/venv/lib/python3.6/site-packages/pymongo/topology.py", line 217, in _select_servers_loop, referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471810 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] (self._error_message(selector), timeout, self.description)), referer: http://dm.nhmarchive.org/
[Thu Oct 21 20:20:14.471814 2021] [wsgi:error] [pid 1430925:tid 139930051188480] [client 99.8.162.56:55665] pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 6171cb5aa3baaebd849f82b2, topology_type: Single, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused',)>]>, referer: http://dm.nhmarchive.org/
The connection to the MongoDB Atlas cluser seems to be refused when app.py tries to perform a query. Below is the code used to establish a conncetion with the database instance in database.py:
import mongoengine
...
from mongoengine import connect
from dotenv import load_dotenv
# Connects to remote Atlas database
def global_init():
load_dotenv()
DB_URI = os.getenv('DB_URI')
connect(alias='laumap', host=DB_URI)
Troubleshooting
Adding the server's IP address to Atlas's 'IP Access List'
While I had 0.0.0.0/0 listed as IP Address (which should theoretically allow all addresses to my understanding), I added the IP address of the server to the list. This still did not work.
Adding pymongo kwargs to MongoEngine connect()
A similar problem was posted on a flask app with Atlas depolyed on python anywhere. They suggested adding the following kwargs when connecting to a database:
connect(alias='laumap', host=DB_URI, connect=False, maxPoolSize=1)
This also did not seem to work.
Adding HTTP Method Overrides
This was done as per the official Flask documentation:
class HTTPMethodOverrideMiddleware(object):
allowed_methods = frozenset([
'GET',
'HEAD',
'POST',
'DELETE',
'PUT',
'PATCH',
'OPTIONS'
])
bodyless_methods = frozenset(['GET', 'HEAD', 'OPTIONS', 'DELETE'])
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
method = environ.get('HTTP_X_HTTP_METHOD_OVERRIDE', '').upper()
if method in self.allowed_methods:
environ['REQUEST_METHOD'] = method
if method in self.bodyless_methods:
environ['CONTENT_LENGTH'] = '0'
return self.app(environ, start_response)
app = Flask(__name__)
app.wsgi_app = HTTPMethodOverrideMiddleware(app.wsgi_app)
I don't have any experience setting HTTP headers in a Flask, so I'm unsure if the above is configured correctly. But as it is currently, it did not change the logged errors.
Testing the .env DB_URI variable in a python interactive session
Just as a sanity check, I made sure that the DB_URI was correctly formed in my .env file. Below is the code used in the python interactive shell on the server:
>>> import mongoengine
>>> from dotenv import load_dotenv
>>> load_dotenv()
True
>>> import os
>>> DB_URI = os.getenv('DB_URI')
>>> mongoengine.connect(alias='laumap', host=DB_URI)
MongoClient(host=['lau-shard-00-00.sybdh.mongodb.net:27017', 'lau-shard-00-
01.sybdh.mongodb.net:27017', 'lau-shard-00-02.sybdh.mongodb.net:27017'],
document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority',
authsource='admin', replicaset='atlas-xvjuv5-shard-0', ssl=True,
read_preference=Primary())
Checking SE Linux Boolean values
As per this stack overflow post, I tried setting the following values to true:
httpd_can_network_connect --> off
httpd_can_network_connect_db --> off
Question
Why is my flask app not able to properly connect to my MongoDB Atlas cluster when it is able to locally, on my Heroku deployment and when I run flask run on the Apache/CentOS 8 server?
Is there some security settings in CentOS 8 that need to properly configured or is there something in the Flask app or wsgi script that may need to be changed?
From the error message (last line) you can see it is not attempting to connect to atlas, it's attempting to connect to localhost (the default if you don't specify a host). So the error will be with the connection string.
Looking at the code, are you 100% sure the DB_URI environment variable is set correctly? Maybe add some logging to confirm.
if I enabled email forwarding, I can't receive any email but when I disabled email forwarding. Then webmail working fine. Anyone, please look into email logs? I don't see any sending and receiving problems. when email forwarding disabled on cyberpanel.
This problem only appear after enabling email forwarding.
Mar 29 07:14:01 blastoff postfix/bounce[2809]: 3DC8B3410DD: sender non-delivery notification: C9CED3410DE
Mar 29 07:14:01 blastoff postfix/qmgr[1082]: 3DC8B3410DD: removed
Mar 29 07:14:01 blastoff postfix/smtp[2934]: connect to gmail-smtp-in.l.google.com[2607:f8b0:4023:c03::1b]:25: Network is unreachable
Mar 29 07:14:02 blastoff postfix/smtp[2934]: C9CED3410DE: to=<riadloud#gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.137.26]:25, delay=0.86, delays=0.01/0.07/0.36/0.42, dsn=2.0.0, status=sent (250 2.0.0 OK 1617002042 i21si16857578otj.220 - gsmtp)
Mar 29 07:14:02 blastoff postfix/qmgr[1082]: C9CED3410DE: removed
Mar 29 07:14:32 blastoff dovecot: imap-login: Login: user=<riad#blastoff.us>, method=PLAIN, rip=::1, lip=::1, mpid=2967, TLS, session=<QfcVoqe+6pUAAAAAAAAAAAAAAAAAAAAB>
Mar 29 07:14:32 blastoff dovecot: imap(riad#blastoff.us)<2967><QfcVoqe+6pUAAAAAAAAAAAAAAAAAAAAB>: Logged out in=89 out=1045 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Mar 29 07:16:32 blastoff dovecot: imap-login: Login: user=<riad#blastoff.us>, method=PLAIN, rip=::1, lip=::1, mpid=3043, TLS, session=<b41Aqae+7JUAAAAAAAAAAAAAAAAAAAAB>
Mar 29 07:16:32 blastoff dovecot: imap(riad#blastoff.us)<3043><b41Aqae+7JUAAAAAAAAAAAAAAAAAAAAB>: Logged out in=89 out=1045 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Mar 29 07:17:18 blastoff postfix/anvil[2916]: statistics: max connection rate 1/60s for (smtp:209.85.217.53) at Mar 29 07:13:56
Mar 29 07:17:18 blastoff postfix/anvil[2916]: statistics: max connection count 1 for (smtp:209.85.217.53) at Mar 29 07:13:56
Mar 29 07:17:18 blastoff postfix/anvil[2916]: statistics: max cache size 1 at Mar 29 07:13:56
Mar 29 07:17:24 blastoff dovecot: imap-login: Login: user=<riad#blastoff.us>, method=PLAIN, rip=::1, lip=::1, mpid=3087, TLS, session=<3BlfrKe+7pUAAAAAAAAAAAAAAAAAAAAB>
Mar 29 07:17:24 blastoff dovecot: imap(riad#blastoff.us)<3087><3BlfrKe+7pUAAAAAAAAAAAAAAAAAAAAB>: Logged out in=240 out=1300 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Mar 29 07:18:17 blastoff spamd[3146]: logger: removing stderr method
Mar 29 07:18:17 blastoff spamd[3148]: config: no rules were found! Do you need to run 'sa-update'?
Mar 29 07:18:18 blastoff spamd[3146]: child process [3148] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3034.
Mar 29 07:18:19 blastoff spamd[3150]: logger: removing stderr method
Mar 29 07:18:19 blastoff spamd[3152]: config: no rules were found! Do you need to run 'sa-update'?
Mar 29 07:18:20 blastoff spamd[3150]: child process [3152] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3034.
Mar 29 07:18:21 blastoff spamd[3156]: logger: removing stderr method
Mar 29 07:18:21 blastoff spamd[3158]: config: no rules were found! Do you need to run 'sa-update'?
Mar 29 07:18:22 blastoff spamd[3156]: child process [3158] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3034.
Mar 29 07:18:23 blastoff spamd[3159]: logger: removing stderr method
Mar 29 07:18:23 blastoff spamd[3161]: config: no rules were found! Do you need to run 'sa-update'?
Mar 29 07:18:24 blastoff spamd[3159]: child process [3161] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3034.
Mar 29 07:18:24 blastoff spamd[3162]: logger: removing stderr method
Mar 29 07:18:24 blastoff spamd[3164]: config: no rules were found! Do you need to run 'sa-update'?
Mar 29 07:18:25 blastoff spamd[3162]: child process [3164] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3034.
Mar 29 07:18:32 blastoff dovecot: imap-login: Login: user=<riad#blastoff.us>, method=PLAIN, rip=::1, lip=::1, mpid=3176, TLS, session=<qhxjsKe+8JUAAAAAAAAAAAAAAAAAAAAB>
Mar 29 07:18:32 blastoff dovecot: imap(riad#blastoff.us)<3176><qhxjsKe+8JUAAAAAAAAAAAAAAAAAAAAB>: Logged out in=89 out=1053 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Mar 29 07:19:15 blastoff postfix/smtpd[3197]: connect from mail-vs1-f45.google.com[209.85.217.45]
Mar 29 07:19:15 blastoff postfix/smtpd[3197]: 9043434088F: client=mail-vs1-f45.google.com[209.85.217.45]
Mar 29 07:19:15 blastoff postfix/smtpd[3197]: warning: connect to /var/log/policyServerSocket: No such file or directory
Mar 29 07:19:16 blastoff postfix/smtpd[3197]: warning: connect to /var/log/policyServerSocket: No such file or directory
Mar 29 07:19:16 blastoff postfix/smtpd[3197]: warning: problem talking to server /var/log/policyServerSocket: No such file or directory
Mar 29 07:19:16 blastoff postfix/cleanup[3201]: 9043434088F: hold: header Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45])??by mail.blastoff.us (Postfix) with ESMTPS id 9043434088F??for <riad#blastoff.us>; Mon, 29 Mar 2021 07:19:15 +0000 (UTC from mail-vs1-f45.google.com[209.85.217.45]; from=<riadloud#gmail.com> to=<riad#blastoff.us> proto=ESMTP helo=<mail-vs1-f45.google.com>
Mar 29 07:19:16 blastoff postfix/cleanup[3201]: 9043434088F: message-id=<CACGWsS=QumtoJMTYX49XNFv7Kbk_-+xhJ4TrZdFezAytvToTow#mail.gmail.com>
Mar 29 07:19:16 blastoff opendkim[920]: 9043434088F: s=20161025 d=gmail.com SSL
Mar 29 07:19:16 blastoff postfix/smtpd[3197]: disconnect from mail-vs1-f45.google.com[209.85.217.45] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Mar 29 07:19:17 blastoff postfix/qmgr[1082]: 07B043410DD: from=<riadloud#gmail.com>, size=2541, nrcpt=2 (queue active)
Mar 29 07:19:19 blastoff postfix/pipe[3212]: 07B043410DD: to=<riad#blastoff.us>, relay=spamassassin, delay=3.7, delays=1.6/0.01/0/2, dsn=5.3.0, status=bounced (command line usage error. Command output: lda: Fatal: Unknown argument: unix Usage: dovecot-lda [-c <config file>] [-d <username>] [-p <path>] [-m <mailbox>] [-e] [-k] [-f <envelope sender>] [-a <original envelope recipient>] [-r <final envelope recipient>] )
Mar 29 07:19:19 blastoff postfix/pipe[3213]: 07B043410DD: to=<riadshout#gmail.com>, orig_to=<riad#blastoff.us>, relay=spamassassin, delay=3.7, delays=1.6/0.02/0/2, dsn=5.3.0, status=bounced (command line usage error. Command output: lda: Fatal: Unknown argument: unix Usage: dovecot-lda [-c <config file>] [-d <username>] [-p <path>] [-m <mailbox>] [-e] [-k] [-f <envelope sender>] [-a <original envelope recipient>] [-r <final envelope recipient>] )
Mar 29 07:19:19 blastoff postfix/cleanup[3201]: 3AEDA3410DE: message-id=<20210329071919.3AEDA3410DE#mail.blastoff.us>
Mar 29 07:19:19 blastoff postfix/bounce[3217]: 07B043410DD: sender non-delivery notification: 3AEDA3410DE
Mar 29 07:19:19 blastoff postfix/qmgr[1082]: 3AEDA3410DE: from=<>, size=6095, nrcpt=1 (queue active)
Mar 29 07:19:19 blastoff postfix/qmgr[1082]: 07B043410DD: removed
Mar 29 07:19:19 blastoff postfix/smtp[3220]: connect to gmail-smtp-in.l.google.com[2607:f8b0:4023:c03::1a]:25: Network is unreachable
Mar 29 07:19:19 blastoff postfix/smtp[3220]: 3AEDA3410DE: to=<riadloud#gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.137.26]:25, delay=0.67, delays=0/0.02/0.29/0.35, dsn=2.0.0, status=sent (250 2.0.0 OK 1617002359 g9si17981450plj.221 - gsmtp)
Mar 29 07:19:19 blastoff postfix/qmgr[1082]: 3AEDA3410DE: removed
There are many configuration issues here.
The one that is causing the reject is:
command line usage error. Command output: lda: Fatal: Unknown argument: unix Usage: dovecot-lda [-c <config file>] [-d <username>] [-p <path>]
But there are also spamassassin issues (no rules found) and other milter issues (/var/log/policyServerSocket missing).
It doesn’t look like a forwarding issue but a general misconfiguration issue.
It is quite difficult to provide a precise advice here, you should review the whole configuration with someone familiar with this stuff.
I wanted to create a classifier, so following the tutorial I did the following :
curl -i -u "apikey:{apikey}" \
-F training_data=#{train.csv} \
-F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\"}" \
"{url}/v1/classifiers"
But, the following 500 error occurs:
HTTP/1.1 200 Connection established
HTTP/1.1 100 Continue
X-EdgeConnect-MidMile-RTT: 0
X-EdgeConnect-Origin-MEX-Latency: 113
HTTP/1.1 500 Internal Server Error
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 176
Expires: Wed, 11 Mar 2020 04:44:04 GMT
Date: Wed, 11 Mar 2020 04:44:04 GMT
Connection: close
<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>
An error occurred while processing your request.<p>
Reference #179.35e52e17.1583901844.39c6106
</BODY></HTML>
What is causing this error?
Thanks!
I followed the instructions in the tutorial and able to create a classifier without any error. Here are the request and response
Request:
curl -i -u "apikey:API_KEY" \
-F training_data=#weather_data_train.csv \
-F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\"}" \
"URL/v1/classifiers"
Response:
HTTP/1.1 100 Continue
X-EdgeConnect-MidMile-RTT: 230
X-EdgeConnect-Origin-MEX-Latency: 95
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 449
X-XSS-Protection: 1
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: 0
strict-transport-security: max-age=31536000; includeSubDomains;
x-global-transaction-id: xxxxxxx
X-DP-Watson-Tran-ID: xxxxxx
X-EdgeConnect-MidMile-RTT: 230
X-EdgeConnect-Origin-MEX-Latency: 2000
X-EdgeConnect-MidMile-RTT: 230
X-EdgeConnect-Origin-MEX-Latency: 95
Date: Wed, 11 Mar 2020 07:05:02 GMT
Connection: keep-alive
{
"classifier_id" : "xxxxx",
"name" : "TutorialClassifier",
"language" : "en",
"created" : "2020-03-11T07:05:01.126Z",
"url" : "URL/v1/classifiers/xxx",
"status_description" : "The classifier instance is in its training phase, not yet ready to accept classify requests",
"status" : "Training"
}%
All I did is
Create the Natural Language Classifier service.
Download the .csv and .json files.
On a terminal or command prompt, point to the folder where I downloaded the .csv and .json files.
From the service credentials page of the service, copy the apikey and url values and replace the placeholders ({apikey}, {url}) in the curl command.
Execute the command to see the above response.
Wildfly not working with mod cluster below is the error_log
[Wed Jan 25 16:53:55.860419 2017] [core:error] [pid 4980:tid 1088] [client 192.168.1.10:64522] AH00135: Invalid method in request bela\x19\x84\x04
[Wed Jan 25 16:54:11.387227 2017] [core:error] [pid 4980:tid 1088] [client 192.168.1.10:64523] AH00135: Invalid method in request bela\x19\x84\x04
[Wed Jan 25 16:54:24.664313 2017] [core:error] [pid 4980:tid 1088] [client 192.168.1.10:64524] AH00135: Invalid method in request bela\x19\x84\x04
[Wed Jan 25 16:54:43.907621 2017] [core:error] [pid 4980:tid 1088] [client 192.168.1.10:64525] AH00135: Invalid method in request bela\x19\x84\x04
[Wed Jan 25 16:54:59.417380 2017] [core:error] [pid 4980:tid 1088] [client 192.168.1.10:64526] AH00135: Invalid method in request bela\x19\x84\x04
[Wed Jan 25 16:55:16.458689 2017] [core:error] [pid 4980:tid 1088] [client 192.168.1.10:64530] AH00135: Invalid method in request bela\x19\x84\x04
I am using TCP instaed of upd and server advertise is off on mod_cluster side
After i made a clear cache i refreshed my page, but this time the browser looks like he doesn't find nothing or he is somewhere blocked, because it shows up near the address that he is searching or loading a page but it stays like that for long long time even hours i can tell.I checked error log and i found this error but i'm newbie i didn't understadn how to solve them:
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP Fatal error: Doctrine\\ODM\\MongoDB\\Hydrator\\HydratorFactory::getHydratorFor(): Failed opening required 'C:/wamp/www/Symfony/app/cache/dev/doctrine/odm/mongodb/Hydrators\\dcBundleDocumentCategoryHydrator.php' (include_path='.;C:\\php\\pear') in C:\\wamp\\www\\Symfony\\vendor\\doctrine\\mongodb-odm\\lib\\Doctrine\\ODM\\MongoDB\\Hydrator\\HydratorFactory.php on line 152, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP Stack trace:, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 1. {main}() C:\\wamp\\www\\Symfony\\web\\app_dev.php:0, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 2. Symfony\\Component\\HttpKernel\\Kernel->handle() C:\\wamp\\www\\Symfony\\web\\app_dev.php:25, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 3. Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle() C:\\wamp\\www\\Symfony\\app\\bootstrap.php.cache:411, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 4. Symfony\\Component\\HttpKernel\\HttpKernel->handle() C:\\wamp\\www\\Symfony\\app\\bootstrap.php.cache:1101, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 5. Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw() C:\\wamp\\www\\Symfony\\app\\bootstrap.php.cache:975, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 6. call_user_func_array() C:\\wamp\\www\\Symfony\\app\\bootstrap.php.cache:1001, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 7. bul\\CrsBundle\\Controller\\CrssController->AllAction() C:\\wamp\\www\\Symfony\\app\\bootstrap.php.cache:1001, referer: http://localhost/Symfony/web/app_dev.php/gps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 8. Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller->render() C:\\wamp\\www\\Symfony\\src\\bul\\CrsBundle\\Controller\\CrsController.php:38, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 9. Symfony\\Bundle\\TwigBundle\\TwigEngine->renderResponse() C:\\wamp\\www\\Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller.php:106, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 10. Symfony\\Bundle\\TwigBundle\\Debug\\TimedTwigEngine->render() C:\\wamp\\www\\Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\TwigBundle\\TwigEngine.php:108, referer: http://localhost/Symfony/web/app_dev.php/groups/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 11. Symfony\\Bundle\\TwigBundle\\TwigEngine->render() C:\\wamp\\www\\Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\TwigBundle\\Debug\\TimedTwigEngine.php:52, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 12. Symfony\\Bridge\\Twig\\TwigEngine->render() C:\\wamp\\www\\Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\TwigBundle\\TwigEngine.php:79, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 13. Twig_Template->render() C:\\wamp\\www\\Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bridge\\Twig\\TwigEngine.php:53, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 14. Twig_Template->display() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:6039, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 15. Twig_Template->displayWithErrorHandling() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:6032, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 16. __TwigTemplate_a9e184d390123fbf02da00b3fedfe39c->doDisplay() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:6051, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 17. Twig_Template->display() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\twig\\a9\\e1\\84d390123fbf02da00b3fedfe39c.php:25, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 18. Twig_Template->displayWithErrorHandling() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:6032, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 19. __TwigTemplate_d7c51e8360cebc4fc46062c39aca8151->doDisplay() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:6051, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 20. Twig_Template->displayBlock() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\twig\\d7\\c5\\1e8360cebc4fc46062c39aca8151.php:120, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 21. call_user_func() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:5999, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 22. __TwigTemplate_a9e184d390123fbf02da00b3fedfe39c->block_body() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:5999, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 23. Doctrine\\ODM\\MongoDB\\Cursor->current() C:\\wamp\\www\\Symfony\\app\\cache\\dev\\classes.php:60, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 24. Doctrine\\ODM\\MongoDB\\UnitOfWork->getOrCreateDocument() C:\\wamp\\www\\Symfony\\vendor\\doctrine\\mongodb-odm\\lib\\Doctrine\\ODM\\MongoDB\\Cursor.php:118, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 25. Doctrine\\ODM\\MongoDB\\Hydrator\\HydratorFactory->hydrate() C:\\wamp\\www\\Symfony\\vendor\\doctrine\\mongodb-odm\\lib\\Doctrine\\ODM\\MongoDB\\UnitOfWork.php:2540, referer: http://localhost/Symfony/web/app_dev.php/grps/
[Wed Aug 07 12:08:34.948850 2013] [:error] [pid 7800:tid 1016] [client ::1:56347] PHP 26. Doctrine\\ODM\\MongoDB\\Hydrator\\HydratorFactory->getHydratorFor() C:\\wamp\\www\\Symfony\\vendor\\doctrine\\mongodb-odm\\lib\\Doctrine\\ODM\\MongoDB\\Hydrator\\HydratorFactory.php:419, referer: http://localhost/Symfony/web/app_dev.php/grps/
Problem solved:I remove the Cache manually and I restart my pc again.It works now
Your error says:
Failed opening required 'C:/wamp/www/Symfony/app/cache/dev/doctrine/odm/mongodb/Hydrators\dcBundleDocumentCategoryHydrator.php' (include_path='.;C:\php\pear')
Do you have that file?