I'm trying to create a muc_room with SMACK api on ejabberd.
after the transaction I get an error:
No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: AndFilter: (FromMatchesFilter (full): instantroom2#localhost/pinit, StanzaTypeFilter: Presence).
the room is created since it is listed in the output of:
ejabberdctl muc_online_rooms localhost
when I look into my sql there is only the one room I created locally
also the timeout thing happens when I try to list muc rooms.
is anyone here familiar with this problem?
my ejabberd.yml:
mod_muc_admin: {}
mod_muc:
## host: "conference.#HOST#"
host: "#HOST#"
access:
- allow
access_admin:
- allow: admin
access_create: muc_create
access_persistent: muc_create
mod_muc_log: {}
## mod_multicast: {}
mod_offline:
access_max_user_messages: max_user_offline_messages
mod_ping: {}
## mod_pres_counter:
## count: 5
## interval: 60
UPDATE:
I found another strange thing, when I destroy muc_rooms they are not listed in muc_rooms_online but not being removed from mysql DB.
after I restart ejabberd they show up back again.
Related
I try to create a DoT Gateway with nginx. However, i get every time when i try to connect via Android private DNS a status 500 response.
My Nginx config looks like this:
stream {
log_format basic '$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received $session_time $upstream_addr';
upstream dns {
server 8.8.8.8:53;
}
server {
listen 853 ssl;
access_log /var/log/nginx/dot-access.log basic;
error_log /var/log/nginx/dot-error.log;
ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.domain.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_timeout 4h;
ssl_handshake_timeout 10s;
proxy_pass dns;
}
}
I have tried to solve the error with https://medium.com/#nykolas.z/troubleshooting-dns-over-tls-e7ca570b6337 and https://www.aaflalo.me/2019/03/dns-over-tls/. A test request with https://getdnsapi.net/query/ works fine and i get "status": GETDNS_RESPSTATUS_GOOD. In in /var/log/nginx/dot-access.log i see
185.49.141.27 [01/Oct/2021:11:59:57 +0200] TCP 200 56 130 0.210 8.8.8.8:53
However, if i enter "my.domain.com" in Android private DNS settings, i get the error message "Connection not possible" and in /var/log/nginx/dot-access.log
84.33.44.28 [01/Oct/2021:11:55:01 +0200] TCP 500 0 0 0.131 -
For me, this means that this setup basically works, however not with Android Private DNS. Anyone with ideas?
I have exactly the same setup and it worked until yesterday.
There seems to be an issue with Let's Encrypt certificates:
https://twitter.com/WatfordJC/status/1443611562028245005
The problem can be solved by adding --preferred-chain="ISRG Root X1" to your certbot request. I just force renewed my certificate and now it is working again.
Other users discussing the topic: https://www.reddit.com/r/Adguard/comments/pynis4/agh_android_private_dns_couldnt_connect/
I'm trying to send a simple GET request using FUEL to my webserver, when I try to debug, I can see what happens when I click the button in the app, then I get this output:
I/DpmTcmClient: RegisterTcmMonitor from: $Proxy1
I/System.out: --> GET http://1.1.1.1/post.php
Body : (empty)
Headers : (0)
I/System.out: <-- -1 http://1.1.1.1/post.php
Response :
Length : 0
I/System.out: Body : (empty)
Headers : (0)
I've changed the IP to a random open one, using my real IP in the script.
This is my script (which is taken from github)
uttonClickMe.setOnClickListener{
Fuel.get("http://1.1.1.1/post.php")
.response { request, response, result ->
println(request)
println(response)
val (bytes, error) = result
if (bytes != null) {
println("[response bytes] ${String(bytes)}")
}
}
}
However I see nothing on my servers end in the logs about requests coming thru, can someone point me in the right direction?
I figured it out, even thru I tried with and without ssl, it was with an invalid ssl cert, it is now working with domain and valid ssl.
Hello fellow developers,
I am developing SIP application using PJSIP library...
Here is my code
And here is my Logcat log
The problem is application is not trying to proceed registration, and no errors at all... (Or I missed something?)
And log on my Kamailio Server (when my device tries to connect and log stucks nothing happens):
22(32406) DEBUG: <core> [ip_addr.c:229]: print_ip(): tcpconn_new: new tcp connection: 192.168.0.150
22(32406) DEBUG: <core> [tcp_main.c:985]: tcpconn_new(): on port 17749, type 3
22(32406) DEBUG: <core> [tcp_main.c:1295]: tcpconn_add(): hashes: 879:4076:3775, 50
22(32406) DEBUG: <core> [io_wait.h:376]: io_watch_add(): DBG: io_watch_add(0x9f8540, 44, 2, 0x7f6cdbbf3948), fd_no=34
ps. I tested server with ready client and everything is ok...
Thanks in advance :)
I have resolved issue...
The problem was in registering PJSIP in another thread... I was using main Thread and initializing connection on OnCreate() event in MainActivity. Which means, after OnCreate() fired and finishes its job, initialization process was getting destroyed before it connects into server...
What I did:
Before:
UaConfig ua_cfg = epConfig.getUaConfig();
ua_cfg.setUserAgent("Pjsua2 Android " + ep.libVersion().getFull());
ua_cfg.setThreadCnt(0);
ua_cfg.setMainThreadOnly(true);
After:
UaConfig ua_cfg = epConfig.getUaConfig();
ua_cfg.setUserAgent("Pjsua2 Android " + ep.libVersion().getFull());
Removing those lines makes PJSIP library to create its own worker thread...
I have got Apache2 Installed and Python working.
I am having a problem though. I have two pages.
One a Python Page and the other an Html Page with JQuery
Can someone please tell me how I can get my ajax post to work correctly.
<html>
<head>
</head>
<body>
<script>
$(function()
{
alert('Im going to start processing');
$.ajax({
url: "saveList.py",
type: "post",
data: {'param':{"hello":"world"}},
dataType: "application/json",
success : function(response)
{
alert(response);
}
});
});
</script>
</body>
</html>
And the Python Code
import sys
import json
def index(req):
result = {'success':'true','message':'The Command Completed Successfully'};
data = sys.stdin.read();
myjson = json.loads(data);
return str(myjson);
OK, let's move to your updated question.
First, you should pass Ajax data property in string representation. Then, since you mix dataType and contentType properties, change dataType value to "json":
$.ajax({
url: "saveList.py",
type: "post",
data: JSON.stringify({'param':{"hello":"world"}}),
dataType: "json",
success: function(response) {
alert(response);
}
});
Finally, modify your code a bit to work with JSON request as follows:
#!/usr/bin/python
import sys, json
result = {'success':'true','message':'The Command Completed Successfully'};
myjson = json.load(sys.stdin)
# Do something with 'myjson' object
print 'Content-Type: application/json\n\n'
print json.dumps(result) # or "json.dump(result, sys.stdout)"
As a result, in the success handler of Ajax request you will receive object with success and message properties.
You should read json data like this:
#!/usr/bin/env python3
import os
import sys
import json
content_len = int(os.environ["CONTENT_LENGTH"])
req_body = sys.stdin.read(content_len)
my_dict = json.loads(req_body)
With the following code, you can run into problems:
myjson = json.load(sys.stdin)
or written less succinctly:
requ_body = sys.stdin.read()
my_dict = json.load(requ_body)
That does work for me when my cgi script is on an apache server, but you can't count on that working in general--as I found out when my cgi script was on another server. According to the cgi spec:
RFC 3875 CGI Version 1.1 October 2004
4.2. Request Message-Body
Request data is accessed by the script in a system-defined method;
unless defined otherwise, this will be by reading the 'standard
input' file descriptor or file handle.
Request-Data = [ request-body ] [ extension-data ]
request-body = <CONTENT_LENGTH>OCTET
extension-data = *OCTET
A request-body is supplied with the request if the CONTENT_LENGTH is
not NULL. The server MUST make at least that many bytes available
for the script to read. The server MAY signal an end-of-file
condition after CONTENT_LENGTH bytes have been read or it MAY supply
extension data. Therefore, the script MUST NOT attempt to read more
than CONTENT_LENGTH bytes, even if more data is available. However,
it is not obliged to read any of the data.
The key line is:
the script MUST NOT attempt to read more
than CONTENT_LENGTH bytes, even if more data is available.
Apparently, apache sends an eof signal to the cgi script immediately after sending the request body to the cgi script, which causes sys.stdin.read() to return. But according to the cgi spec, a server is not required to send an eof signal after the body of the request, and I found that my cgi script was hanging on sys.stdin.read()--when my script was on another server, which eventually caused a timeout error.
Therefore, in order to read in json data in the general case, you should do this:
content_len = int(os.environ["CONTENT_LENGTH"])
req_body = sys.stdin.read(content_len)
my_dict = json.loads(req_body)
The server sets a bunch of environment variables for cgi scripts, which contain header information, one of which is CONTENT_LENGTH.
Here is what a failed curl request looked like when I used myjson = json.load(sys.stdin):
-v verbose output
-H specify one header
--data implicitly specifies a POST request
Note that curl automatically calculates a Content-Length header
for you.
~$ curl -v \
> -H 'Content-Type: application/json' \
> --data '{"a": 1, "b": 2}' \
> http://localhost:65451/cgi-bin/1.py
* Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 65451 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 65451 (#0)
> POST /cgi-bin/1.py HTTP/1.1
> Host: localhost:65451
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 16
>
* upload completely sent off: 16 out of 16 bytes
=== hung here for about 5 seconds ====
< HTTP/1.1 504 Gateway Time-out
< Date: Thu, 08 Mar 2018 17:53:30 GMT
< Content-Type: text/html
< Server: inets/6.4.5
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection 0
Adding a little bit to the great #7stud's answer
I had some problems with content length when reading unicode which I fixed by reading from buffer:
content_length = int(os.environ["CONTENT_LENGTH"])
data = sys.stdin.buffer.read(content_length).decode('utf-8')
I hope someone can give some insight into this bizarre issue
I have a iJetty WebApp on my android device. We have the ability to clear our H2 DB after the user shuts down their jetty server but the Dalvik vm is online.
I get an exception after the following case:
1. Start server
2. login to system (This creates the H2 db if its not there, and where the connections are made)
3. stop the server (this issues a disconnect to all the connections to the DB)
4. delete the h2 DB from the app (This deletes the h2 db file)
5. start the app
6. login to system (This creates the H2 db if its not there, and where the connections are made)
Things work fine when I do this twice. But when on the third time i get this exception:
java.lang.ExceptionInInitializerError
.
.
.
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:569)
at java.sql.DriverManager.getDrivers(DriverManager.java:258)
at org.apache.commons.dbcp.BasicDataSource.<clinit>(BasicDataSource.java:57)
... 41 more
Notes on the issue:
I looked at http://www.mkyong.com/websphere/basicdatasource-causing-java-util-concurrentmodificationexception-in-websphere/
We don't init the actual datasource in Spring at all. we do a call in Java: BasicDataSource dataSource = new BasicDataSource(); whenever a new connection needs to be made.
When the Jetty server goes down I tried issueing the SQL command "SHUTDOWN" this did not change anything.
Looking at the code for DriverManager I am confused how the exception could even happen. They do a synchronized on the arraylist they are iterating over.
I originally posted the issue on the H2 forum to check if they notice it. I don't think its an H2 specific thing. (https://groups.google.com/forum/#!topic/h2-database/OiKNgnYjOSM)
Any Thoughts would be appreciated
UPDATE
Below is the call for Andorid's DriverManager.java for API 17 (It happens in 18 as well). If I can find a link to their repo I will post that
/**
* Returns an {#code Enumeration} that contains all of the loaded JDBC
* drivers that the current caller can access.
*
* #return An {#code Enumeration} containing all the currently loaded JDBC
* {#code Drivers}.
*/
public static Enumeration<Driver> getDrivers() {
/*
* Synchronize to avoid clashes with additions and removals of drivers
* in the DriverSet
*/
ClassLoader callerClassLoader = VMStack.getCallingClassLoader();
synchronized (theDrivers) {
ArrayList<Driver> result = new ArrayList<Driver>();
for (Driver driver : theDrivers) { // THIS IS THE OFFENDING LINE
if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) {
result.add(driver);
}
}
return Collections.enumeration(result);
}
}