Error From res_odbc - centos

I have connected my odbc to MSSQL server and I'm getting sip accounts and dialplan from that and I also can call between two peers but asterisk gets error :
'[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to MSSQL [MSSQL]...
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1528 odbc_obj_connect: Connecting MSSQL
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to MSSQL [MSSQL]
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42000: [FreeTDS][SQL Server]The invalid escape character "\\" was specified in a LIKE predicate. (89)
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to MSSQL [MSSQL]...
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1528 odbc_obj_connect: Connecting MSSQL
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to MSSQL [MSSQL]
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42000: [FreeTDS][SQL Server]The invalid escape character "\\" was specified in a LIKE predicate. (89)
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to MSSQL [MSSQL]...
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1528 odbc_obj_connect: Connecting MSSQL
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to MSSQL [MSSQL]
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42000: [FreeTDS][SQL Server]The invalid escape character "\\" was specified in a LIKE predicate. (89)
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to MSSQL [MSSQL]...
[Jan 26 16:43:16] WARNING[32715]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1528 odbc_obj_connect: Connecting MSSQL
[Jan 26 16:43:16] NOTICE[32715]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to MSSQL [MSSQL]'

As clearly state in asterisk documentation you have option for escape charaster which is probably incorrect set in your config.
in sample config file:
; Is the backslash a native escape character? The default is yes, but for
; MS SQL Server, the answer is no.
;backslash_is_escape => yes

Related

Postgresql "Cluster is not running" after running for a while

I set up a postgresql db on azure VM, Ubuntu server 18.04.
but it goes down after running for a while without any other error message.
Here is what I got from sudo systemctl status postgresql#10-main.service
Feb 18 08:08:52 server crontab[17689]: (postgres) LIST (postgres)
Feb 18 08:08:52 server crontab[17692]: (postgres) LIST (postgres)
Feb 18 08:08:52 server crontab[17695]: (postgres) LIST (postgres)
Feb 18 08:08:52 server crontab[17697]: (postgres) REPLACE (postgres)
Feb 18 08:08:52 server crontab[17698]: (postgres) LIST (postgres)
Feb 18 08:08:52 server crontab[17700]: (postgres) REPLACE (postgres)
Feb 18 08:08:52 server crontab[17701]: (postgres) LIST (postgres)
Feb 18 08:08:53 server postgresql#10-main[17704]: Cluster is not running.
Feb 18 08:08:53 server systemd[1]: postgresql#10-main.service: Control process exited, code=exited status=2
Feb 18 08:08:53 server systemd[1]: postgresql#10-main.service: Failed with result 'exit-code'.
sudo systemctl restart postgresql.service may temporarily resolve this problem, but may reoccur after a while.
Does anyone face the same issue?
Any advice?
Thank you.
In my case, postgresql was killed by the oom killer.

Facing connection reset and timeout error while sending email through sendmail via smtp. How to fix this?

i've got a problem configuring sendmail to send email through smtp.
My goal is to have the ability to send mail from a php application using smtp.
I've to migrate to a new server some old legacy php application which use the standard "mail()" php function, and i can't modify the code, so i can't just use something like "phpMailer" or "pear mail package" instead.
I've followed this guide (venice answer) sendmail: how to configure sendmail on ubuntu? , and watched many other that say the same thing...
I've already installed and configured sendmail, and it works fine for sending local mail (if i send an email to root#localhost, i receive it correctly) but not for sending "normal" email..
Every time i send an email i've got these error in the mail.log file:
Nov 26 15:38:17 compute-prod-main-2-vm sm-mta[22434]: xAQFcH3g022434: from=<Mattia#compute-prod-main-2-vm.europe-west1-b.c.fine-command-242712.in>, size=418, class=0, nrcpts=1, msgid=<201911261538.xAQFcHXA022433#compute-prod-main-2-vm.europe-west1-b.c.fine-command-242712.in>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Nov 26 15:38:17 compute-prod-main-2-vm sendmail[22433]: xAQFcHXA022433: to=mattiabonzi#libero.it, ctladdr=Mattia (1002/1005), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30105, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (xAQFcH3g022434 Message accepted for delivery)
Nov 26 15:38:33 compute-prod-main-2-vm sendmail[22444]: xAQFcXYx022444: from=Mattia, size=80, class=0, nrcpts=1, msgid=<201911261538.xAQFcXYx022444#compute-prod-main-2-vm.europe-west1-b.c.fine-command-242712.in>, relay=root#localhost
Nov 26 15:38:33 compute-prod-main-2-vm sm-mta[22445]: xAQFcXOb022445: from=<Mattia#compute-prod-main-2-vm.europe-west1-b.c.fine-command-242712.in>, size=469, class=0, nrcpts=1, msgid=<201911261538.xAQFcXYx022444#compute-prod-main-2-vm.europe-west1-b.c.fine-command-242712.in>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Nov 26 15:38:33 compute-prod-main-2-vm sendmail[22444]: xAQFcXYx022444: to=mattiabonzi#openworks.it, ctladdr=Mattia (1002/1005), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30080, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (xAQFcXOb022445 Message accepted for delivery)
Nov 26 15:38:37 compute-prod-main-2-vm sm-mta[21588]: xAQFXbC8021586: timeout waiting for input from authsmtp.securemail.pro during client greeting
Nov 26 15:38:37 compute-prod-main-2-vm sm-mta[21588]: xAQFXbC8021586: to=<mattiabonzi#libero.it>, delay=00:05:00, xdelay=00:05:00, mailer=relay, pri=120418, relay=authsmtp.securemail.pro [81.88.48.66], dsn=4.0.0, stat=Deferred: Connection timed out with authsmtp.securemail.pro
Nov 26 15:41:00 compute-prod-main-2-vm sm-mta[21743]: xAQFa0cV021741: timeout waiting for input from authsmtp.securemail.pro during client greeting
Nov 26 15:41:00 compute-prod-main-2-vm sm-mta[21743]: xAQFa0cV021741: to=<mattiabonzi#libero.it>, delay=00:05:00, xdelay=00:05:00, mailer=relay, pri=120418, relay=authsmtp.securemail.pro [81.88.48.66], dsn=4.0.0, stat=Deferred: Connection timed out with authsmtp.securemail.pro
Nov 26 15:42:02 compute-prod-main-2-vm sm-mta[21765]: xAQFb1PN021763: timeout waiting for input from authsmtp.securemail.pro during client greeting
Nov 26 15:42:02 compute-prod-main-2-vm sm-mta[21765]: xAQFb1PN021763: to=<mattiabonzi#libero.it>, delay=00:05:01, xdelay=00:05:01, mailer=relay, pri=120418, relay=authsmtp.securemail.pro [81.88.48.66], dsn=4.0.0, stat=Deferred: Connection timed out with authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQFNe4X021461: to=<mattiabonzi#libero.it>, delay=00:19:26, xdelay=00:05:00, mailer=relay, pri=210466, relay=authsmtp.securemail.pro [81.88.48.66], dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQFH7gj020614: to=<mattiabonzi#libero.it>, delay=00:25:59, xdelay=00:00:00, mailer=relay, pri=300466, relay=authsmtp.securemail.pro, dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQFBfZq020461: to=<mattiabonzi#openworks.it>, delay=00:31:25, xdelay=00:00:00, mailer=relay, pri=300469, relay=authsmtp.securemail.pro, dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQEkePb016232: to=<mattiabonzi#openworks.it>, delay=00:56:26, xdelay=00:00:00, mailer=relay, pri=390469, relay=authsmtp.securemail.pro, dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQEkfdA016262: to=<mattiabonzi#openworks.it>, delay=00:56:25, xdelay=00:00:00, mailer=relay, pri=390469, relay=authsmtp.securemail.pro, dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQEkgiG016272: to=<mattiabonzi#openworks.it>, delay=00:56:24, xdelay=00:00:00, mailer=relay, pri=390469, relay=authsmtp.securemail.pro, dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
Nov 26 15:43:06 compute-prod-main-2-vm sm-mta[22415]: xAQEkfEJ016252: to=<mattiabonzi#openworks.it>, delay=00:56:25, xdelay=00:00:00, mailer=relay, pri=390469, relay=authsmtp.securemail.pro, dsn=4.0.0, stat=Deferred: Connection reset by authsmtp.securemail.pro
This is what i've initialy added to the sendmail.mc file
define(`SMART_HOST',`authsmtp.securemail.pro')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
I've made some research and understood that the problem may be the port that sendmail is using for the smtp connection.
i've tried to telnet my isp and i'm able to contact it only on port 465, but i cannot find a way to change the port that sendmail is using.
I've tried to add those line, but with no luck:
define(`ESMTP_MAILER_ARGS', `TCP $h 465')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 465')dnl
I've also noticed that one antoher server that i have with sendmal instaled and propely configured is using the mailer esmtp, this installation use insted relay, is that normal?
What i'm doing wrong?
Thank yuo in advance, hope that i've listed all the relevant details.
First find more info. Force delivery retry in verbose mode with SMTP session tracking.
It provides useful hints in most cases (well above 50% based on my experience).
To push email with queue id xAQEkfEJ016252 as root execute the following command:
sendmail -v -qIxAQEkfEJ016252

How do I connect to Exasol from Scala?

I want to connect to ExaSol database using Scala. I'm able to connect to the database in Python using pyodbc but I'm receiving the following error on attempting to connect using JDBC driver in Scala :
scala> :require /Users/some/path/mssql-jdbc-7.4.0.jre8.jar
scala> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")
scala> import java.sql.{Connection, DriverManager, ResultSet}
scala> val conn = DriverManager.getConnection("jdbc:sqlserver://11.11.11.11:8563;databaseName=some-db;user=user_name;password=pass_word;useUnicode=true;characterEncoding=UTF-8")
Sep 11, 2019 1:38:55 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:2 ClientConnectionId: a03dede8-7f9c-495d-83d5-4986b859e1e9 Prelogin error: host 11.11.11.11 port 8563 Unexpected end of prelogin response after 0 bytes read
Sep 11, 2019 1:38:55 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:2 ClientConnectionId: ea705538-c0c9-4bc3-ba66-9630e7850b58 Prelogin error: host 11.11.11.11 port 8563 Unexpected end of prelogin response after 0 bytes read
Sep 11, 2019 1:39:09 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:2 ClientConnectionId: 5238ac7c-55cc-4ec2-a070-d7f454c6c43b Prelogin error: host 11.11.11.11 port 8563 Unexpected end of prelogin response after 0 bytes read
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 11.11.11.11, port 8563 has failed. Error: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later.". ClientConnectionId:5238ac7c-55cc-4ec2-a070-d7f454c6c43b
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2924)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2913)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:2655)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2480)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2142)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1993)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1164)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:760)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
... 28 elided
Please try to use the "com.exasol.jdbc.EXADriver" driver.
The documentation is in the below url:
https://docs.exasol.com/connect_exasol/drivers/jdbc.htm

meanjs app deploy mongodb connection fails but works local

meanjs app, database connection fail (mongoHQ), string hard coded:
db: 'mongodb://user:pass#server.mongohq.com/db_name'
1) package.json: https://gist.github.com/anonymous/c864fbc2572bd10f7e90
2) log error: https://gist.github.com/anonymous/09726b7458560fe8e5f3
3) jitsu v0.14.0, node v0.10.33 and npm v2.1.8
4) platform : linux
db string above is used for development and production environment for testing purpose. Issue is that I can connect and add entries to the database in a local environment (dev env) but once I deploy or push to either herokuapp or nodejitsu I get the following error:
nodejitsu log:
out Wed, 19 Nov 2014 23:39:34 GMT
out Wed, 19 Nov 2014 23:39:34 GMT Application loaded using the "production" environment configuration
out Wed, 19 Nov 2014 23:39:34 GMT
err Wed, 19 Nov 2014 23:39:36 GMT
err Wed, 19 Nov 2014 23:39:36 GMT events.js:72
err Wed, 19 Nov 2014 23:39:36 GMT ^
err Wed, 19 Nov 2014 23:39:36 GMT throw er; // Unhandled 'error' event
err Wed, 19 Nov 2014 23:39:36 GMT Error: failed to connect to [localhost:27017]
at null. (/opt/run/snapshot/package/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:549:74)
at emit (events.js:106:17)
at null. (/opt/run/snapshot/package/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15)
at emit (events.js:98:17)
at Socket. (/opt/run/snapshot/package/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:533:10)
at Socket.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:419:13)
heroku log:
2014-11-19T23:27:22.425635+00:00 app[web.1]: MEAN.JS application started on port 15050
2014-11-19T23:27:22.430865+00:00 app[web.1]: events.js:72
2014-11-19T23:27:22.434306+00:00 app[web.1]: ^
2014-11-19T23:27:22.430483+00:00 app[web.1]:
2014-11-19T23:27:22.436997+00:00 app[web.1]: at emit (events.js:106:17)
2014-11-19T23:27:22.437004+00:00 app[web.1]: at Socket.emit (events.js:95:17)
2014-11-19T23:27:22.437006+00:00 app[web.1]: at net.js:440:14
2014-11-19T23:27:22.431432+00:00 app[web.1]: throw er; // Unhandled 'error' event
2014-11-19T23:27:22.436991+00:00 app[web.1]: Error: failed to connect to [localhost:27017]
2014-11-19T23:27:22.436996+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:549:74)
2014-11-19T23:27:22.436999+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15)
2014-11-19T23:27:22.437001+00:00 app[web.1]: at emit (events.js:98:17)
2014-11-19T23:27:22.437003+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:533:10)
2014-11-19T23:27:22.437008+00:00 app[web.1]: at process._tickCallback (node.js:419:13)
2014-11-19T23:27:22.452476+00:00 app[web.1]: error: Forever detected script exited with code: 8
I found a connection code in one of my models needed for an auto-increment plugin.
var connection = mongoose.createConnection('mongodb://localhost/n-express-dev');
replaced with the following to get it to deploy without errors.
var connection = mongoose.createConnection(process.env.MONGOHQ_URI || process.env.MONGOLAB_URI || 'mongodb://localhost/n-express-dev');

practical limit for the number of databases in mongodb

Can anyone say are if there is any practical limit for the number of databases in mongodb? I've started to have serious problems when I passed 120 databases. Simple things like :
> show dbs
Mon Feb 10 16:35:32 DBClientCursor::init call() failed
Mon Feb 10 16:35:32 query failed : admin.$cmd { listDatabases: 1.0 } to: 127.0.0.1:27017
Mon Feb 10 16:35:32 Error: error doing query: failed src/mongo/shell/collection.js:155
Mon Feb 10 16:35:32 trying reconnect to 127.0.0.1:27017
Mon Feb 10 16:35:32 reconnect 127.0.0.1:27017 failed couldn't connect to server 127.0.0.1:27017
>
Mon Feb 10 16:36:01 trying reconnect to 127.0.0.1:27017
Mon Feb 10 16:36:01 reconnect 127.0.0.1:27017 failed couldn't connect to server 127.0.0.1:27017
>
Mon Feb 10 16:37:01 trying reconnect to 127.0.0.1:27017
Mon Feb 10 16:37:01 reconnect 127.0.0.1:27017 ok
and
> getMemInfo()
{ "virtual" : 32, "resident" : 7 }
Mon Feb 10 16:39:00 DBClientCursor::init call() failed
Mon Feb 10 16:39:00 query failed : admin.$cmd { replSetGetStatus: 1.0, forShell: 1.0 } to: 127.0.0.1:27017
> shell
Mon Feb 10 16:39:38 ReferenceError: shell is not defined (shell):1
Mon Feb 10 16:39:38 trying reconnect to 127.0.0.1:27017
Mon Feb 10 16:39:38 reconnect 127.0.0.1:27017 ok
Yet the log file stayed enigmatic
What version of mongodb are you running on what host?
Here is a test on CenOS 6.5, mongodb 2.2 x86_64 direct from EPEL
Here is a sample python script that creates 1000 databases
from pymongo import MongoClient
mc = MongoClient()
for i in range(5000):
print i
mc['db%s'%(i)].test.insert({"test":True})
output:
...snip...
506
Traceback (most recent call last):
File "overload_mongo.py", line 6, in <module>
mc['db%s'%(i)].test.insert({"test":True})
File "/usr/lib64/python2.6/site-packages/pymongo/collection.py", line 357, in insert
continue_on_error, self.__uuid_subtype), safe)
File "/usr/lib64/python2.6/site-packages/pymongo/mongo_client.py", line 929, in _send_message
raise AutoReconnect(str(e))
pymongo.errors.AutoReconnect: [Errno 104] Connection reset by peer
There it is, looking at the log
ERROR: Uncaught std::exception: boost::filesystem::basic_directory_iterator constructor: Too many open files: "/index/bauman/db/_tmp/esort.1392056635.506/", terminating
The good ole too many open files problem
If you are on a enterprise linux platform, you can drop this file into /etc/security/limits.d/mongodb.conf and start a new session
mongodb hard nofile 99999
mongodb soft nofile 99999
mongodb hard nproc 99999
mongodb soft nproc 99999
I dont know how to achieve a similar result on windows.
The 'problem' lies in that MongoDB wants to memory map every single database file, so you need your hostOS to allow it to do so.
Same code as above
python overload_mongo.py
Output
...snip...
995
996
997
998
999
All better