Error Calling Console App from Web Form - asp.net

This is related to another question I asked:
ProcessStartInfo Multiple Arguments
I got this working with no errors in Windows Logs when run from the command line. Basically, I'm calling the console application from a Web Form. I'm passing two string arguments: an email subject and an email body. The console application then sends an email to a drop folder (for now).
const string MAILER_FILEPATH = #"C:\VS2010\Mailer\bin\Debug\Mailer.exe";
ProcessStartInfo info = new ProcessStartInfo();
string arguments = String.Format(#"""{0}"" ""{1}""",
message.Subject.Replace(#"""", #""""""),
message.Body.Replace(#"""", #""""""));
info.FileName = MAILER_FILEPATH;
Process process = Process.Start(info.FileName, arguments);
Process.Start(info);
When I call the console app from the Web Form, it still created the email in the drop folder but also generates two consecutive errors in the Windows Application Log:
Error 1:
Application: Mailer.exe Framework Version: v4.0.30319 Description:
The process was terminated due to an unhandled exception. Exception
Info: System.IndexOutOfRangeException Stack: at
Mailer.Mailer.Main(System.String[])
Error 2:
Faulting application name: Mailer.exe, version: 1.0.0.0, time stamp:
0x4ebab7ad Faulting module name: KERNELBASE.dll, version:
6.1.7601.17651, time stamp: 0x4e21213c Exception code: 0xe0434352 Fault offset: 0x000000000000cacd Faulting process id: 0x1648 Faulting
application start time: 0x01cc9f079d89d950 Faulting application path:
C:\VS2010\Mailer\bin\Release\Mailer.exe Faulting module path:
C:\Windows\system32\KERNELBASE.dll Report Id:
dbf249c0-0afa-11e1-a04b-a4badb02debf

The problem was caused by enclosing my console code with:
if (args.Length >= 0)
{
}
By changing this to >=1, the no more errors were logged!

Related

How to connect to Neptune using Version 4 Signing dependency

I have an EC2 instance that can connect to gremlin using the Gremlin Console, or by pulling in this repository and running the maven command.
However, when I use the recommended Version 4 signing dependency:
dependencies {
compile(
...
// neptune sigv4
[group: "com.amazonaws", name:"aws-java-sdk-core", version: "1.11.307"],
[group: "com.amazonaws", name:"amazon-neptune-sigv4-signer", version: "1.0"],
[group: "com.amazonaws", name:"amazon-neptune-gremlin-java-sigv4", version: "1.0"],
...
)
}
On a very similar hello world program:
package com.test.neptune;
import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.Result;
import org.apache.tinkerpop.gremlin.driver.ResultSet;
import org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer;
import org.neo4j.cypher.internal.frontend.v2_3.repeat;
public class NeptuneExampleCopy {
private static final String NEPTUNE_ENDPOINT = "my.endpoint.url";
private static final int NEPTUNE_PORT = 0;
public static void main(String[] args) {
// connect to the neptune cluster
final Cluster cluster = Cluster.build()
.addContactPoint(NEPTUNE_ENDPOINT)
.port(NEPTUNE_PORT)
.channelizer(SigV4WebSocketChannelizer.class)
.create();
// run a traversal, print the results
final Client client = cluster.connect();
final ResultSet rs = client.submit("g.V().count()");
for (Result r : rs) {
System.out.println(r);
}
// close the cluster
cluster.close();
}
}
Gradle throws the following exception:
Apr 25, 2019 5:24:21 PM io.netty.channel.ChannelInitializer exceptionCaught
WARNING: Failed to initialize a channel. Closing: [id: 0xd894eb28]
com.amazon.neptune.gremlin.driver.exception.SigV4PropertiesNotFoundException: Unable to load SigV4 properties from any of the providers
at com.amazon.neptune.gremlin.driver.sigv4.ChainedSigV4PropertiesProvider.getSigV4Properties(ChainedSigV4PropertiesProvider.java:74)
at com.amazon.neptune.gremlin.driver.sigv4.AwsSigV4ClientHandshaker.loadProperties(AwsSigV4ClientHandshaker.java:102)
at com.amazon.neptune.gremlin.driver.sigv4.AwsSigV4ClientHandshaker.<init>(AwsSigV4ClientHandshaker.java:64)
at org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer.createHandler(SigV4WebSocketChannelizer.java:210)
at org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer.configure(SigV4WebSocketChannelizer.java:176)
at org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:140)
at org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:92)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:113)
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:105)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:617)
at io.netty.channel.DefaultChannelPipeline.access$000(DefaultChannelPipeline.java:46)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1467)
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1141)
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:666)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:510)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:423)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:482)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:214)
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:198)
at com.test.neptune.NeptuneExampleCopy.main(NeptuneExampleCopy.java:25)
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
at org.apache.tinkerpop.gremlin.driver.Client.submitAsync(Client.java:310)
at org.apache.tinkerpop.gremlin.driver.Client.submitAsync(Client.java:242)
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:212)
... 2 more
Caused by: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.chooseConnection(Client.java:499)
at org.apache.tinkerpop.gremlin.driver.Client.submitAsync(Client.java:305)
... 4 more
Apr 25, 2019 5:24:22 PM io.netty.channel.ChannelInitializer exceptionCaught
WARNING: Failed to initialize a channel. Closing: [id: 0xc3ff34e0]
com.amazon.neptune.gremlin.driver.exception.SigV4PropertiesNotFoundException: Unable to load SigV4 properties from any of the providers
at com.amazon.neptune.gremlin.driver.sigv4.ChainedSigV4PropertiesProvider.getSigV4Properties(ChainedSigV4PropertiesProvider.java:74)
at com.amazon.neptune.gremlin.driver.sigv4.AwsSigV4ClientHandshaker.loadProperties(AwsSigV4ClientHandshaker.java:102)
at com.amazon.neptune.gremlin.driver.sigv4.AwsSigV4ClientHandshaker.<init>(AwsSigV4ClientHandshaker.java:64)
at org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer.createHandler(SigV4WebSocketChannelizer.java:210)
at org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer.configure(SigV4WebSocketChannelizer.java:176)
at org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:140)
at org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:92)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:113)
How could this code be fixed? Is there a better Version 4 signing dependency?
SigV4 handler tries to fetch your AWS Credentials through multiple credential providers. If no credential provider was initialized, then you are bound to see this exception. How have you initialized your AWS Credentials? You could use any of the standard sources, like environment variables, or JVM system properties or the like. See the documentation below for more details:
https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth-connecting-gremlin-java.html
Update: Do make sure you are using the latest versions of all the packages and dependencies.
For example:
// neptune sigv4 [group: "com.amazonaws",
name:"aws-java-sdk-core", version: "1.11.542"],
[group: "com.amazonaws",
name:"amazon-neptune-sigv4-signer", version: "1.0.4"],
[group: "com.amazonaws",
name:"amazon-neptune-gremlin-java-sigv4", version: "1.0.5"],
// for neptune [group: "org.apache.tinkerpop",
name: "gremlin-driver", version: "3.4.1"]

Exception 504 when registering the consumer

I've been working with Symfony 2.7 and the RabbitMQBundle to handle some long processes asynchronously.
After facing the issue where the MySQL connection dies after a few minutes, I discovered rabbitmq-cli-consumer, a small app in Go that takes care of consuming the queue, and gives its content to a command.
In my case, I use it with this command: ./rabbitmq-cli-consumer -c configuration-stock.conf --include -V -e 'php app/console amqp:consume:stock --env=prod -vvv', with this configuration file:
[rabbitmq]
host = HOST
username = USERNAME
password = PASSWORD
vhost=/VHOST
port=PORT
queue=stock
compression=Off
[exchange]
name=exports
type=direct
durable=On
[queuesettings]
routingkey=stock
messagettl=10000
deadLetterExchange=exports.dl
deadLetterroutingkey=stock
priority=10
To handle errors, I intend to use RabbitMQ's x-dead-letter-exchange and x-dead-letter-routing-key configuration, to be able to retry the message later (in case something went temporarly wrong).
My issue is that, when I define my queues in RabbitMQBundle's configuration, rabbitmq-cli-consumer is unable to consume the queue, throwing this error:
2018/04/23 11:35:54 Connecting RabbitMQ...
2018/04/23 11:35:54 Connected.
2018/04/23 11:35:54 Opening channel...
2018/04/23 11:35:54 Done.
2018/04/23 11:35:54 Setting QoS...
2018/04/23 11:35:54 Succeeded setting QoS.
2018/04/23 11:35:54 Declaring queue "stock"...
2018/04/23 11:35:54 Registering consumer...
2018/04/23 11:35:54 failed to register a consumer: Exception (504) Reason: "channel/connection is not open"
Here is the configuration I use for RabbitMQBundle:
old_sound_rabbit_mq:
producers:
exports:
connection: default
exchange_options:
name: 'exports'
type: direct
exports_dl:
connection: default
exchange_options:
name: 'exports.dl'
type: direct
consumers:
stock_dead_letter:
connection: default
exchange_options:
name: exports.dl
type: direct
queue_options:
name: stock.dl
routing_keys:
- stock
arguments:
x-dead-letter-exchange: ['S', 'exports']
x-dead-letter-routing-key: ['S', 'stock']
x-message-ttl: ['I', 60000]
callback: amqp.consumers.exports.stock
multiple_consumers:
exports:
connection: default
exchange_options:
name: 'exports'
type: direct
queues:
stock:
name: stock
callback: amqp.consumers.exports.stock
routing_keys:
- stock
arguments:
x-dead-letter-exchange: ['S', 'exports.dl']
x-dead-letter-routing-key: ['S', 'stock']
Has anyone ever encountered something similar ? And how did you solve it ?

webdriver io crashes inside a jade template on rendered function

I am testing my meteor app's UI with some browser tests. I use http://webdriver.io and a selenium chrome https://hub.docker.com/r/selenium/standalone-chrome/ node.
I use the webdriver.io testrunner for tests and mocha as the test framework.
When I enter this block inside a jade template (by opening the corresponding page):
Template.boardBody.onRendered(function() {
let imagePath = new ReactiveVar('');
this.autorun(() => {
imagePath.set(Meteor.settings.public.backgroundPath[1]);
//document.getElementsByClassName('board-wrapper')[0].style.backgroundImage = "url('" + imagePath.get() + "')";
$('.board-wrapper').css('background-image', "url('" + path + "')");
});
}
The headless chrome crashes with this error:
{ Error: An unknown server-side error occurred while processing the command.
at BoardPage.open (tests/board.page.js:20:5)
at Context.<anonymous> (tests/board.test.js:22:17)
at Promise.F (node_modules/core-js/library/modules/_export.js:35:28)
at execute(<Function>) - at BoardPage.open (tests/page.js:11:13)
message: 'unknown error: session deleted because of page crash\nfrom tab crashed',
type: 'RuntimeError',
screenshot: 'Just a black page',
seleniumStack:
{ status: 13,
type: 'UnknownError',
message: 'An unknown server-side error occurred while processing the command.',
orgStatusMessage: 'unknown error: session deleted because of page crash\nfrom tab crashed\n (Session info: chrome=59.0.3071.115)\n (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.4.4-200.fc22.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 4.13 seconds\nBuild info: version: \'3.4.0\', revision: \'unknown\', time: \'unknown\'\nSystem info: host: \'f362d8ab8951\', ip: \'172.17.0.1\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.4.4-200.fc22.x86_64\', java.version: \'1.8.0_131\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver\nCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57), userDataDir=/tmp/.org.chromium.Chromium.NUsUeZ}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=59.0.3071.115, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]\nSession ID: f1e261ec57fde3697e98945af051d236' },
shotTaken: true }
I use chai.expect for my assertion statements and i have a feeling that the promises are somehow messing up the headless chrome.
Anyone knows why this is happening?

Event ID: 1325, Source: ASP.NET 4.0.30319.0

Could any One Help Me Identify the Error and suggest a solution Please.
Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 3/6/2015 7:28:58 AM
Event ID: 1325
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: XXX
Description:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/3/ROOT
Process ID: 13528
Exception: System.Threading.ThreadStateException
Message: Unable to retrieve thread information.
StackTrace: at System.Threading.Thread.GetThreadStateNative()
at FiftyOne.Foundation.Mobile.Detection.NewDevice.Dispose()
at FiftyOne.Foundation.Mobile.Detection.NewDevice.Finalize()
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="ASP.NET 4.0.30319.0" />
<EventID Qualifiers="49152">1325</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2015-03-06T13:28:58.000Z" />
<EventRecordID>173806</EventRecordID>
<Channel>Application</Channel>
<Computer>379501-dy.ord.intensive.int</Computer>
<Security />
</System>
<EventData>
<Data>An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/3/ROOT
Process ID: 13528
Exception: System.Threading.ThreadStateException
Message: Unable to retrieve thread information.
StackTrace: at System.Threading.Thread.GetThreadStateNative()
at FiftyOne.Foundation.Mobile.Detection.NewDevice.Dispose()
at FiftyOne.Foundation.Mobile.Detection.NewDevice.Finalize()</Data>
</EventData>
</Event>
I got this error message today; my solution is to remove the module from my codebase. A tad extreme, but I don't want third-party modules that when they crash, kill the entire application pool.

IIS8 The Just-In-Time debugger was launched without necessary security permissions

Windows Server 2012 64 bit
IIS8
ASP.NET Framework 4
Trying to run an unmanaged DLL from my aspx page
Executing the DLL Function call gives:
The Just-In-Time debugger was launched without necessary security permissions. To debug this process, the Just-In-Time debugger must be run as an Administrator. Would you like to debug this process?
There is no debugger that I know of on the web server, trying to launch it gives errors.
Why is my call to my DLL crashing my aspnet worker process?
How can I tell IIS8 there is no debugger?
I have googled this extensively, and all the help seems to be about Visual Studio, not IIS. There is no Visual Studio on the web sever.
Here is the offending code.
private string regname = "";
private string fingerprint = "";
private string unlockingcode = "";
/// <summary>
/// called from page_load
/// </summary>
private void CreateUnlockingCode()
{
UInt32 lfp;
string sfp = fingerprint.Remove(4, 1);
lfp = Convert.ToUInt32(sfp, 16);
string bindir = Server.MapPath(#"~/bin/CodeGen64.dll"); //full path to the DLL "P:\\AFI2013\\bin\\CodeGen64.dll"
IntPtr pDll = NativeMethods.LoadLibrary(bindir); //attempt to load the library
try
{
IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "CreateCode2A");
CreateCode2 createCode2 = (CreateCode2)Marshal.GetDelegateForFunctionPointer(
pAddressOfFunctionToCall,
typeof(CreateCode2));
//THIS LINE CRASHES THE ASPNET WORKER PROCESS
unlockingcode = createCode2(1, regname, encrypt_template, lfp, (UInt16)0, (UInt16)0, (UInt16)0, (UInt16)0, (UInt16)0);
}
finally
{
bool result = NativeMethods.FreeLibrary(pDll);
}
}
And here is the Error from the Event Viewer.
Log Name: Application
Source: Application Error
Date: 7/10/2013 11:34:30 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: owl.INT.local
Description:
Faulting application name: w3wp.exe, version: 8.0.9200.16384, time stamp: 0x50108835
Faulting module name: ntdll.dll, version: 6.2.9200.16579, time stamp: 0x51637f77
Exception code: 0xc0000374
Fault offset: 0x00000000000ebd59
Faulting process id: 0x2608
Faulting application start time: 0x01ce7d9c1d409343
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 5b36e881-e98f-11e2-9406-000c2908dae4
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-07-10T18:34:30.000000000Z" />
<EventRecordID>54586</EventRecordID>
<Channel>Application</Channel>
<Computer>owl.INT.local</Computer>
<Security />
</System>
<EventData>
<Data>w3wp.exe</Data>
<Data>8.0.9200.16384</Data>
<Data>50108835</Data>
<Data>ntdll.dll</Data>
<Data>6.2.9200.16579</Data>
<Data>51637f77</Data>
<Data>c0000374</Data>
<Data>00000000000ebd59</Data>
<Data>2608</Data>
<Data>01ce7d9c1d409343</Data>
<Data>c:\windows\system32\inetsrv\w3wp.exe</Data>
<Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
<Data>5b36e881-e98f-11e2-9406-000c2908dae4</Data>
<Data>
</Data>
<Data>
</Data>
</EventData>
</Event>

Resources