How to exit from a python session on channel hangup .? - mod-python

My scripts keeps on giving me error log
Channel is hungup and application 'curl' does not have the zombie_exec flag
Can anybody tell my how to exit session on channel hangup ?

For calls with dialplan add to dialplan
<action application="set_zombie_exec"/>

Related

Program stalls on "DEBUG Starting new HTTPS connection (1): login.microsoftonline.com:443" only when executed via cron

I'm using the python-O365 library in order to access my O365 mailbox. The project requires me to execute the program in a docker container. If I start the program manually (as root), everything works fine, but if I try to start it via cron, it stalls on DEBUG Starting new HTTPS connection (1): login.microsoftonline.com:443, which I found out after activating logging.
The minimal code example that reproduces the error (with log):
import O365
from utils.credentials import get_credentials
import logging # We want to get additional information
logging.basicConfig(
filename='./easy_log_file.log',
filemode='a',
format='%(levelname)s %(message)s', # %(asctime)s %(pathname)s %(lineno)d
level=logging.DEBUG
)
filename = "o365_token.txt"
token_backend = O365.FileSystemTokenBackend(token_path = filename)
account = O365.Account(get_credentials(), token_backend=token_backend)
inbox = account.mailbox().inbox_folder()
messages = inbox.get_messages()
for message in messages:
logging.info(message)
logging.info("finished")
To start it via cron, I used the following command:
echo "15 21 * * * bash /workspace/daemon_start.sh >> /workspace/cronlogs/logs_daemon_mail.log" | crontab. If I start the program manually, the log continues like this:
DEBUG Starting new HTTPS connection (1): graph.microsoft.com:443
DEBUG https://graph.microsoft.com:443 "GET /v1.0/me/mailFolders/Inbox/messages?%24top=100&%24filter=isRead+eq+false HTTP/1.1" 200 None
DEBUG Received response (200) from URL https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?%24top=100&%24filter=isRead+eq+false
If the program is started via cron, sometimes the log continues like this:
DEBUG Incremented Retry for (url='/common/oauth2/v2.0/token'): Retry(total=2, connect=3, read=3, redirect=None, status=None)
WARNING Retrying (Retry(total=2, connect=3, read=3, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))': /common/oauth2/v2.0/token
In order to resolve the issue, I added my proxy by using account = Account(credentials, token_backend=token_backend, proxy_server="proxy.my_proxy.com"). It's strange, that I would have to add it, for the container is already configured to use this proxy. When I tried it with this setting, I encountered the same issue, only that the log when started with cron was continued always and much faster.
Since I think, that cron simply starts the program and does not meddle with the connections, it doesn't make sense to me, that I get different outcomes by starting it manually or with cron.

Not able to run azure logic apps locally using VScode and Azurite

I am using VSCode to create and test my logic apps locally. I have created a simple HTTP trigger and response for it. I have installed all the components and versions correctly. I am getting below error when I run my logic apps,
**Workflow Error: operationName='WorkflowDefinitionProvider.ProcessWorkflow', message='Workflow 'test-1' validate and create workflow failed, the error is 'One or more errors occurred. (Unexpected HTTP status code 'NotFound'.) (Unexpected HTTP status code 'NotFound'.)'', exception='System.AggregateException: One or more errors occurred. (Unexpected HTTP status code 'NotFound'.) (Unexpected HTTP status code 'NotFound'.)
[2022-05-03T02:52:23.134Z] ---> Microsoft.WindowsAzure.Storage.StorageException: Unexpected HTTP status code 'NotFound'.
[2022-05-03T02:52:23.136Z] ---> System.Net.WebException: The remote server returned an error: (404) Not Found.**
It is also giving me below error in the logs,
**ErrorCode:
[2022-05-03T03:08:44.593Z] ', extensionVersion='1.0.0.0', siteName='UNDEFINED_SITE_NAME', slotName='', activityId='00000000-0000-0000-0000-000000000000'.
[2022-05-03T03:08:44.595Z] The listener for function 'Functions.WorkflowDispatcher' was unable to start.
[2022-05-03T03:08:44.595Z] The listener for function 'Functions.WorkflowDispatcher' was unable to start. Microsoft.WindowsAzure.ResourceStack: Unexpected HTTP status code 'NotFound'. The remote server returned an error: (404) Not Found.**
The process to test that I am following,
Start azurite in VSCode
and then Execute function - func host start
Anyone has any clue or faced similar problems? I am using logic apps first time.
To be able to test HTTP triggers locally you need to
"To locally run webhook-based triggers and actions, such as the built-in HTTP Webhook trigger, in Visual Studio Code, you need to set up forwarding for the callback URL."
https://learn.microsoft.com/en-us/azure/logic-apps/create-single-tenant-workflows-visual-studio-code

Debug Assertion Failed in mfc140ud

I use vs2015. When I run my program in debug mode this debug assertion failed happend.
Anyone knows how to deal with it?
Release mode is OK.
Thank you for your replys. I think the mainly reason is the socket workthread sendmessage to close the socket itself in a multi-thread application.

wsadmin script timing out when executing against DMGR via SOAP

I'm attempting to start and stop an application on a single JVM via the wsadmin console since the Web UI for IBM BPM PS Adv. doesn't allow for that kind of operation. So, I have the following script:
https://gist.github.com/predatorian3/b8661c949617727630152cbe04f78d7e
and when I run it against the DMGR from the Cell Host, I receive the following errors.
[wasadmin#server01 ~]$ cat /usr/local/bin/Run_wsadmin.sh
#!/bin/bash
#
#
#
/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -user serviceAccount -password password $*
[wasadmin#cessoapscrt00 ~]$ time Run_wsadmin.sh -f /opt/IBM/wsadmin/wsadmin_Restart_Application.py WPS00 CRT00WPS01 redirectResource_war
WASX7209I: Connected to process "dmgr" on node CRTDMGR using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[WPS00, CRT00WPS01, redirectResource_war]"
WASX7017E: Exception received while running file "/opt/IBM/wsadmin/wsadmin_Restart_Application.py"; exception information: com.ibm.websphere.management.exception.ConnectorException
org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]
real 3m21.275s
user 0m17.411s
sys 0m0.796s
So, I'm not specifying the connection types, and using the default, which is SOAP. However, upon reading about the other Connection Types, none of them seem any better, but I attribute that to IBM Documentation vagueness. Is there an option to increase the timeout wait periods, or turn it off, or is there a better connection type?
Also running this directly on the wsadmin console, it seems that it is hanging up on gathering the application manager string.
[wasadmin#server01 ~]$ Run_wsadmin.sh
WASX7209I: Connected to process "dmgr" on node CRTDMGR using SOAP connector; The type of process is: DeploymentManager WASX7031I: For help, enter: "print Help.help()"
wsadmin>appManager = AdminControl.queryNames('cell=CRTCELL,node=WPS00,type=ApplicatoinManager,process=CRT00WPS01,*')
WASX7015E: Exception running command: "appManager = AdminControl.queryNames('cell=CRTCELL,node=WPS00,type=ApplicationManager,process=CRT00WPS01,*')"; exception information:
com.ibm.websphere.management.exception.ConnectorException
org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]
wsadmin>
You can increase timeout value in {profile}/properties/soap.client.props
com.ibm.SOAP.requestTimeout=180
If you want to turn off timeout, modify com.ibm.SOAP.requestTimeout=0
Or if you want longer timeout you can modify the value 180 to something else.
Also about your query command, I noticed that you have a typo on the MBean type, you had type=ApplicatoinManager, it should be type=ApplicationManager
HERE YOU GO -- I had the same issue. I want to override the timeout prop temporarily. This worked like a champ. Make sure you follow below steps exactly.I did some mistakes and the prop did not passed, I figured out and it works.
Copy the soap.client.props file from /properties and give it a new name such as mysoap.client.props.
Edit mysoap.client.props and update the value of com.ibm.SOAP.requestTimeout as required
Create a new Java properties file soap_override.props and enter the following line:
com.ibm.SOAP.ConfigURL=file:/mysoap.client.props
Pass soap_override.props into wsadmin using the -p option: wsadmin -p soap_override.props...
REFERENCE:
https://www.ibm.com/developerworks/community/blogs/timdp/entry/avoiding_wsadmin_request_timeouts_the_neat_way32?lang=en

Tigase refuses Tsung

I set up a tigase(5.1.5) server, and succeed to register, login and chat using Spark. But strangely I failed to use tsung(1.5.0) to perform loading test.
I use the jabber_registrer.xml as tsung script. The tsung log shows the error, it seems that tigase refuses the connection from tsung:
=INFO REPORT==== 28-Jun-2013::02:39:32 ===
ts_client:(4:<0.6960.0>) connection close while sending message !
=INFO REPORT==== 28-Jun-2013::02:39:32 ===
ts_client:(5:<0.6960.0>) Server must have closed connection upon us, waiting 10 msec
My tigase.conf:
ENC="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
DRV="-Djdbc.drivers=com.mysql.jdbc.Driver"
GC="-XX:+UseBiasedLocking -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:ParallelCMSThreads=8 -XX:-ReduceInitialCardMarks"
EX="-XX:+OptimizeStringConcat -XX:+DoEscapeAnalysis -XX:+UseNUMA"
JAVA_HOME="${JAVA_HOME}"
CLASSPATH=""
JAVA_OPTIONS="${GC} ${EX} ${ENC} ${DRV} -server -Xms100M -Xmx2000M -XX:PermSize=32m -XX:MaxPermSize=256m -XX:MaxDirectMemorySize=128m "
TIGASE_CONFIG="etc/tigase.xml"
TIGASE_OPTIONS=" --property-file etc/init.properties --test "
My init.properties:
config-type=--gen-config-def
--admins=admin#$xmppserver.com
--virt-hosts = www.xmppserver.com
--monitoring=jmx:9050,http:9080,snmp:9060
--auth-db=tigase-auth
--user-db=mysql
--user-db-uri=jdbc:mysql://127.0.0.1:3306/tigasedb?user=root&password=111111&useUnicode=true&characterEncoding=UTF-8
--user-repo-pool-size=12
I use db-create-mysql.sh to set up my database:
#scripts/db-create-mysql.sh tigase_user tigase_passwd tigasedb root 111111 localhost
My first goal is to create some users in tigase by tsung, but I got this error and can not create any user at all.
I ran tsung on server itself, then on a client PC, both get the same error. Is there anyone has the same problem? Thanks for any answer!
Thanks kellogs, it's my bad.
The problem is in the script of tsung. In section, the "domain" value must be the same as "virt-hosts" value in etc/init.properties of tigase.
And why tigase said "Address already in use" is because it was once aborted abnormally, kill the jvm process manually can resolve this.