Gatling is freezing when I use jsonPath - scala

I have Gatling version 3.0.0-RC4.
I have the following Gatling code
object Signup {
val feeder = csv("phones.csv").circular
var signup = tryMax(2) {
exec(
http("Get details")
.get("/v2/dummy/2")
.check(status.is(200))
)
.feed(feeder)
.exec(
http("Signup")
.post("/v2/user/customer")
.header(HttpHeaderNames.ContentType, HttpHeaderValues.ApplicationJson)
.header(HttpHeaderNames.Accept, HttpHeaderValues.ApplicationJson)
.header("Set-Cookie", "id=2")
.body(StringBody("""{
"email": "rm#gmail.com",
"phone_number": "${phoneNumber}",
"first_name": "Rishi",
"last_name": "Mukherjee",
"pin": "1234",
}""")).asJson
.check(
jsonPath("$.otp_data.otp_uuid").saveAs("lastResponse")))
}.exitHereIfFailed
}
In the line, jsonPath("$.otp_data.otp_uuid").saveAs("OTPUUID"), if I replace that with status.is(200), the code runs just fine. But, with this line, on running the program, it freezes and keeps showing the following
================================================================================
2018-10-12 17:36:11 5s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=1 KO=0 )
> Get details (OK=1 KO=0 )
---- Signup -------------------------------------------------------------
[--------------------------------------------------------------------------] 0%
waiting: 0 / active: 1 / done: 0
================================================================================
Problem is, I do not get any error or anything that will be helpful to debug. In fact this also happens when I run the included example AdvancedSimulationStep03.scala. What can be the issue or is there anything I may be missing?

So, I had JDK 11. The docs say I should have had JDK 8. Switched to JDK 8 and it got fixed.
Hopefully helps anyone else if they get stuck.

Related

Spark Job SUBMITTED but not RUNNING after submit via REST API

Following the instructions in this website, I'm trying to submit a job to Spark via REST API /v1/submissions.
I tried to submit SparkPi in the example:
$ ./create.sh
{
"action" : "CreateSubmissionResponse",
"message" : "Driver successfully submitted as driver-20211212044718-0003",
"serverSparkVersion" : "3.1.2",
"submissionId" : "driver-20211212044718-0003",
"success" : true
}
$ ./status.sh driver-20211212044718-0003
{
"action" : "SubmissionStatusResponse",
"driverState" : "SUBMITTED",
"serverSparkVersion" : "3.1.2",
"submissionId" : "driver-20211212044718-0003",
"success" : true
}
create.sh:
curl -X POST http://172.17.197.143:6066/v1/submissions/create --header "Content-Type:application/json;charset=UTF-8" --data '{
"appResource": "/home/ruc/spark-3.1.2/examples/jars/spark-examples_2.12-3.1.2.jar",
"sparkProperties": {
"spark.master": "spark://172.17.197.143:7077",
"spark.driver.memory": "1g",
"spark.driver.cores": "1",
"spark.app.name": "REST API - PI",
"spark.jars": "/home/ruc/spark-3.1.2/examples/jars/spark-examples_2.12-3.1.2.jar",
"spark.driver.supervise": "true"
},
"clientSparkVersion": "3.1.2",
"mainClass": "org.apache.spark.examples.SparkPi",
"action": "CreateSubmissionRequest",
"environmentVariables": {
"SPARK_ENV_LOADED": "1"
},
"appArgs": [
"400"
]
}'
status.sh:
export DRIVER_ID=$1
curl http://172.17.197.143:6066/v1/submissions/status/$DRIVER_ID
But when I try to get the status of the job (even after a few minutes), I got a "SUBMITTED" rather than "RUNNING" or "FINISHED".
Then I looked up the log and found that
21/12/12 04:47:18 INFO master.Master: Driver submitted org.apache.spark.deploy.worker.DriverWrapper
21/12/12 04:47:18 WARN master.Master: Driver driver-20211212044718-0003 requires more resource than any of Workers could have.
# ...
21/12/12 04:49:02 WARN master.Master: Driver driver-20211212044718-0003 requires more resource than any of Workers could have.
However, in my spark-env.sh, I have
export SPARK_WORKER_MEMORY=10g
export SPARK_WORKER_CORES=2
I have no idea what happened. How can I make it run normally?
Since you've checked resources and You have enough. It might be network issue. executor maybe cannot connect back to driver program. Allow traffic on both master and workers.

Ejabberd - ejabberd_auth_external:failure:103 External authentication program failed when calling 'check_password'

I already have a schema of users with authentication-key and wanted to do authentication via that. I tried implementing authentication via sql but due to different structure of my schema I was getting error and so I implemented external-authentication method. The technologies and OS used in my application are :
Node.JS
Ejabberd as XMPP server
MySQL Database
React-Native (Front-End)
OS - Ubuntu 18.04
I implemented the external authentication configuration as mentioned in https://docs.ejabberd.im/admin/configuration/#external-script and took php script https://www.ejabberd.im/files/efiles/check_mysql.php.txt as an example. But I am getting the below mentioned error in error.log. In ejabberd.yml I have done following configuration.
...
host_config:
"example.org.co":
auth_method: [external]
extauth_program: "/usr/local/etc/ejabberd/JabberAuth.class.php"
auth_use_cache: false
...
Also, is there any external auth javascript script?
Here is the error.log and ejabberd.log as mentioned below
error.log
2019-03-19 07:19:16.814 [error]
<0.524.0>#ejabberd_auth_external:failure:103 External authentication
program failed when calling 'check_password' for admin#example.org.co:
disconnected
ejabberd.log
2019-03-19 07:19:16.811 [debug] <0.524.0>#ejabberd_http:init:151 S:
[{[<<"api">>],mod_http_api},{[<<"admin">>],ejabberd_web_admin}]
2019-03-19 07:19:16.811 [debug]
<0.524.0>#ejabberd_http:process_header:307 (#Port<0.13811>) http
query: 'POST' <<"/api/register">>
2019-03-19 07:19:16.811 [debug]
<0.524.0>#ejabberd_http:process:394 [<<"api">>,<<"register">>] matches
[<<"api">>]
2019-03-19 07:19:16.811 [info]
<0.364.0>#ejabberd_listener:accept:238 (<0.524.0>) Accepted connection
::ffff:ip -> ::ffff:ip
2019-03-19 07:19:16.814 [info]
<0.524.0>#mod_http_api:log:548 API call register
[{<<"user">>,<<"test">>},{<<"host">>,<<"example.org.co">>},{<<"password">>,<<"test">>}]
from ::ffff:ip
2019-03-19 07:19:16.814 [error]
<0.524.0>#ejabberd_auth_external:failure:103 External authentication
program failed when calling 'check_password' for admin#example.org.co:
disconnected
2019-03-19 07:19:16.814 [debug]
<0.524.0>#mod_http_api:extract_auth:171 Invalid auth data:
{error,invalid_auth}
Any help regarding this topic will be appreciated.
1) Your config about the auth_method looks good.
2) Here is a python script I've used and upgraded to make an external authentication for ejabberd.
#!/usr/bin/python
import sys
from struct import *
import os
def openAuth(args):
(user, server, password) = args
# Implement your interactions with your service / database
# Return True or False
return True
def openIsuser(args):
(user, server) = args
# Implement your interactions with your service / database
# Return True or False
return True
def loop():
switcher = {
"auth": openAuth,
"isuser": openIsuser,
"setpass": lambda(none): True,
"tryregister": lambda(none): False,
"removeuser": lambda(none): False,
"removeuser3": lambda(none): False,
}
data = from_ejabberd()
to_ejabberd(switcher.get(data[0], lambda(none): False)(data[1:]))
loop()
def from_ejabberd():
input_length = sys.stdin.read(2)
(size,) = unpack('>h', input_length)
return sys.stdin.read(size).split(':')
def to_ejabberd(result):
if result:
sys.stdout.write('\x00\x02\x00\x01')
else:
sys.stdout.write('\x00\x02\x00\x00')
sys.stdout.flush()
if __name__ == "__main__":
try:
loop()
except error:
pass
I didn't created the communication with Ejabberd from_ejabberd() and to_ejabberd(), and unfortunately can't find back the sources.

Facebook Analytics For Apps Export API Request Running For Almost 20 hours

I have created a request to export app events using POST and did get a FB ID for the export job created. Now when I poll using a GET Url as specified in the docs, I see that it shows 'RUNNING', its has been almost 20 hours now, is this normal? below is what gets returned.
{
"id": "231136770698184",
"start_ts": "2017-04-12T23:04:26+0000",
"end_ts": "2017-04-12T23:21:06+0000",
"status": "RUNNING",
"column_names": [
"server_time",
"event_name",
"client",
"app_version",
"numeric_data",
"event_log_time",
"custom1",
"custom2",
"custom3",
"custom4",
"custom5",
"custom6",
"custom7",
"custom8",
"custom9",
"custom10",
"custom11",
"custom12",
"custom13",
"custom14",
"custom15",
"custom16",
"custom17",
"custom18",
"custom19",
"custom20",
"custom21",
"custom22",
"custom23",
"custom24",
"custom25",
"analytics_app_id",
"ad_tracking_enabled",
"usd_amount",
"ext_user_agent",
"ext_device_model",
"ext_device_os",
"timezone",
"ext_carrier",
"screen_dimensions",
"total_disk_gb",
"remaining_disk_gb",
"invoking_ui_element",
"is_device_id_anonymous",
"raw_advertiser_id"
]
}
-Thanks
SM

Illegal character in query at index 40: facebook

Sorry, I am reformulating the question; I was so frustrated by this Error that I posted the question in a snap.
I am trying to use camel-facebook component and using very simple route that figures as such in the blueprint.xml file:
from uri="facebook://me?oAuthAppId={{oAuthAppId}}&oAuthAppSecret={{oAuthAppSecret}}&oAuthAccessToken={{oAuthAccessToken}}&consumer.delay=86400000"/>
I am using :
Red Hat JBoss Developer Studio
Version: 10.1.0.GA
Actually I see the bundle started :
[ 348] [Active ] [Created ] [ ] [ 80] MyApp [fbdemo] (1.0.0.SNAPSHOT)
Also :
[ 333] [Active ] [ ] [ ] [ 50] camel-facebook (2.17.0.redhat-630187)
Perhaps I have the error mentioned above, I put XXXXXXXXX for oAuth*.
2017-02-14 16:02:16,128 | ERROR | 68)-192.168.56.1 | BlueprintCamelContext | 234 - org.apache.camel.camel-blueprint - 2.17.0.redhat-630187 | Error occurred during starting Camel: CamelContext(blueprintContext) due Failed to create route fbRoute: Route(fbRoute)[[From[facebook://me?oAuthAppId={{oAuthAppId}}... because of Failed to resolve endpoint: facebook://me?oAuthAppId=XXXXXXXXXXXXXX
&oAuthAppSecret=XXXXXXXXXXXXXXXXXXXXXX&oAuthAccessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&consumer.delay=86400000 due to: Illegal character in query at index 40: facebook://me?oAuthAppId=XXXXXXXXXXXXXXXXXXXXXXX
&oAuthAppSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&oAuthAccessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&consumer.delay=86400000
org.apache.camel.FailedToCreateRouteException: Failed to create route fbRoute: Route(fbRoute)[[From[facebook://me?oAuthAppId={{oAuthAppId}}... because of Failed to resolve endpoint: facebook://me?oAuthAppId=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
&oAuthAppSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXX&oAuthAccessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&consumer.delay=86400000 due to: Illegal character in query at index 40: facebook://me?oAuthAppId=XXXXXXXXXXXXXXXX
Shall the oAuthAccessToken be the Application AccesToken or User AccessToken that I get from Facebook Graph Explorer. Note that I don`t have any special character in code secret only a | ( pipe) in case the AccessToken is the Appli AccessToken not User AccessToken. How to figure the index 40.
Thank you very much
If you are using xml then you need to check that all "&" symbols are encoded as "&" so it will looks like:
<from url="facebook://me?oAuthAppId=XXXXXXXXXXXXX&oAuthAppSecret=XXXXXXXXXXXXXXXXXXXXXXXXX&oAuthAccessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&consumer.delay=86400000" />

Zend_Test_PHPUnit how to print exception/output?

How can I echo a html/xml output from a controller action in my test case?
Here is my testcase:
public function testCreateAccountIsASuccessfulRequest()
{
$this->dispatch('/v2/user/create-account');
$this->assertFalse($this->response->isException());
$this->assertNotRedirect();
}
Which prints this in commandline:
test# /usr/local/bin/phpunit --verbose Controllers_UserControllerTest.php
PHPUnit 3.6.10 by Sebastian Bergmann.
F
Time: 0 seconds, Memory: 12.50Mb
There was 1 failure:
1) Controllers_UserControllerTest::testCreateAccountIsASuccessfulRequest
Failed asserting that true is false.
/path/to/tests/Controllers/UserControllerTest.php:17
/usr/local/bin/phpunit:46
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
test#
I am not sure what is the actual exception. How to see it? Also, how can I see the actual output of the controller action? So HTML/XML it sends to browser?
God I am slow today:
public function testCreateAccountIsASuccessfulRequest()
{
$this->dispatch('/v2/user/create-account');
echo $this->getResponse()->getBody();
$this->assertFalse($this->response->isException());
$this->assertNotRedirect();
}