I am getting EXC_GUARD when launching app using NSTask launchedTaskWithLaunchPath - objective-c

Faulting code:
myTask = [NSTask launchedTaskWithLaunchPath: appPath arguments: initArray];
Where myTask is a global static NSTask* myTask = NULL; and initArray is a global static NSMutableArray *initArray = NULL; and appPath is a local NSString*
Exception Type: EXC_GUARD
Exception Codes: 0x4000000200000001, 0x326e91a2a5c769eb
Exception Subtype: GUARD_TYPE_FD, id=0x326e91a2a5c769eb, fd=1, flavor=0x00000002 (DUP)
Top of stack:
0 libsystem_kernel.dylib 0x00007fff2033848e dup + 10
1 com.apple.Foundation 0x00007fff2126df14 -[NSConcreteTask launchWithDictionary:error:] + 2491
2 com.apple.Foundation 0x00007fff21294c89 +[NSTask launchedTaskWithLaunchPath:arguments:] + 146
This issue is not reproducible and this code has not been changed since years. Please suggest some ways to debug this.
Additional info: Parent app which is launching this task has its output stream and error stream set to a log file but both the streams have been set after this app gets launched.

Related

"Output file stream not open": Error while running SE for X86 using gem5

I'm trying to run a SE simulation for x86 platform. Whenever I run the sample command on the website, but it doesn't work
The error log is as follows:
gem5.opt: build/X86/base/output.cc:93: OutputFile<StreamType>::OutputFile(const OutputDirectory&, const string&, std::ios_base::openmode, bool) [with StreamType = std::basic_ofstream<char>; std::__cxx11::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::_Ios_Openmode]: Assertion `_fstream->is_open()' failed.
Program aborted at tick 0
--- BEGIN LIBC BACKTRACE ---
build/X86/gem5.opt(_Z15print_backtracev+0x15)[0x16d8065]
build/X86/gem5.opt(_Z12abortHandleri+0x39)[0x16e8989]
/lib64/libpthread.so.0[0x390200f7e0]
/lib64/libc.so.6(gsignal+0x35)[0x3901832495]
/lib64/libc.so.6(abort+0x175)[0x3901833c75]
/lib64/libc.so.6[0x390182b60e]
/lib64/libc.so.6(__assert_perror_fail+0x0)[0x390182b6d0]
build/X86/gem5.opt(_ZN15OutputDirectory4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt13_Ios_Openmodebb+0x281)[0xa8ed01]
build/X86/gem5.opt(_ZN5Stats8initTextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb+0x3f)[0xaaef9f]
build/X86/gem5.opt[0x16bdde0]
build/X86/gem5.opt[0x99f9e1]
build/X86/gem5.opt(PyEval_EvalFrameEx+0x7cf3)[0x180e6e3]
build/X86/gem5.opt(PyEval_EvalCodeEx+0x89c)[0x180ff6c]
build/X86/gem5.opt[0x188502e]
build/X86/gem5.opt(PyObject_Call+0x3a)[0x177e29a]
build/X86/gem5.opt(PyEval_EvalFrameEx+0xe76)[0x1807866]
build/X86/gem5.opt(PyEval_EvalCodeEx+0x89c)[0x180ff6c]
build/X86/gem5.opt(PyEval_EvalFrameEx+0x6318)[0x180cd08]
build/X86/gem5.opt(PyEval_EvalFrameEx+0x641a)[0x180ce0a]
build/X86/gem5.opt(PyEval_EvalCodeEx+0x89c)[0x180ff6c]
build/X86/gem5.opt(PyEval_EvalFrameEx+0x6318)[0x180cd08]
build/X86/gem5.opt(PyEval_EvalCodeEx+0x89c)[0x180ff6c]
build/X86/gem5.opt(PyEval_EvalCode+0x19)[0x1810059]
build/X86/gem5.opt(PyRun_StringFlags+0xf5)[0x1837db5]
build/X86/gem5.opt(_Z6m5MainiPPc+0x5f)[0x16e74bf]
build/X86/gem5.opt(main+0x38)[0x7410d8]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x390181ed1d]
build/X86/gem5.opt[0x766d31]
--- END LIBC BACKTRACE ---
Abort

Sparkle checkForUpdatesInBackground places no request on webserver

In my command-line application, when calling [[SUUpdater sharedUpdater] checkForUpdatesInBackground], project Sparkle does not place an HTTPS request on my webserver. I want a call to checkForUpdatesInBackground to succeed, so I know my setup is right. I am using an Nginx webserver over HTTPS, and view the logs of this server to make sure the appcast.xml file is being requested.
I have tried debugging the Sparkle framework, and found out after calling checkForUpdatesInBackground, the framework does call dispatch_async in here. This gave the following stack trace.
2018-12-20 06:46:46.037297-0800 MyApplication[28705:224144] Stack trace : (
0 ??? 0x00000001005a7b0e 0x0 + 4300897038
1 MyApplication 0x0000000100001af0 main + 0
2 Sparkle 0x000000010036a5f9 -[SUAppcast fetchAppcastFromURL:inBackground:completionBlock:] + 1625
3 Sparkle 0x0000000100372fff -[SUBasicUpdateDriver checkForUpdatesAtURL:host:] + 1423
4 Sparkle 0x00000001003aabe5 -[SUUpdater checkForUpdatesWithDriver:] + 773
5 Sparkle 0x00000001003aa41e -[SUUpdater checkForUpdatesInBackground] + 494
6 MyApplication 0x0000000100001b9f main + 175
7 libdyld.dylib 0x00007fff5ddd1085 start + 1
)
My Info.plist:
{
"SUAllowsAutomaticUpdates" = NO;
CFBundleIconFile = "myicon.icns";
CFBundleExecutable = MyApplication;
"SUAutomaticallyUpdate" = NO;
"SUScheduledCheckInterval" = 3600;
"SUEnableAutomaticChecks" = NO;
SUPublicEDKey = "0xe+xaH4VBOMIADOqOqBAZug/hnrCqBKUyCffx+8Qvw=";
SUFeedURL = "https://test.myurl.com/appcast.xml";
CFBundleVersion = "1.0.0.0";
"CFBundleShortVersionString" = "7.0";
CFBundleIdentifier = "nl.apps.myapp";
}
My Code:
int main(int argc, const char * argv[]) {
#autoreleasepool {
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
}
}
Sparkle does halt the termination of my application in order to wait for the request to end. On my webserver I do not see the appcast.xml being requested, and Sparkle does not show a window with any update information.
In my case, like Rengers pointed out, Sparkle does not work because it is a command-line tool. This means there exists no main loop where Sparkle depends on. Sparkle places some of its actions on the main event queue using dispatch_async, for example here in the source code.
To overcome this, I've made my command-line tool into a GUI, and now it all works fine.

HOWTO look 'Session Login Items' in swift?

i am trying to get the list of Session Login Items to see if the current application is already registered, but something goes wrong....
Here is a snapshot of the code:
var loginItems : LSSharedFileListRef=LSSharedFileListCreate(nil, kLSSharedFileListSessionLoginItems!.takeUnretainedValue(), nil)!.takeUnretainedValue()
var seed :UInt32 = 0
var theLoginItemsRef=loginItems as LSSharedFileListRef
var loginItemsArray=LSSharedFileListCopySnapshot(theLoginItemsRef, &seed).takeUnretainedValue()
for item in (loginItemsArray as NSArray){
var itemRef = item as LSSharedFileListItemRef
var url=LSSharedFileListItemCopyResolvedURL(itemRef,0,nil).takeUnretainedValue()
// do something with url
}
it compiles, but at runtime it complains because of the Downcasting (var itemRef = item as LSSharedFileListItemRef) and crashes.
(The loginItems gets the type of __NSCFType (??!!?) does it matters?)
it gives me the following error:
* thread #1: tid = 0x66fb, 0x000000010db218a6 libswiftCore.dylib`swift_dynamicCastUnknownClassUnconditional + 134, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
* frame #0: 0x000000010db218a6 libswiftCore.dylib`swift_dynamicCastUnknownClassUnconditional + 134
frame #1: 0x000000010ddb1bb4 $__lldb_expr65`top_level_code + 2996 at playground65.swift:20
frame #2: 0x000000010ddb1e61 $__lldb_expr65`main + 49 at <EXPR>:0
...
Any suggestions?

Error while running Flume agent

I m using flume1.4.0 with hbase0.94.10 and hadoop1.1.2....I m new to flume.while i m running an flume agent, i got following error..
Error occurred during initialization of VM The size of the object heap + VM data exceeds the maximum representable size org.apache.flume.node.Application --conf-file=/usr/local/flume/conf/flume.conf --name agent
Exception in thread "main" java.lang.NoClassDefFoundError: occurred
Caused by: java.lang.ClassNotFoundException: occurred
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: occurred. Program will exit.
my agent configuration is as follows:
agent1.sources = tail
agent1.channels = memoryChannel
agent1.sinks = sink1
agent1.sources.tail.type = exec
agent1.sources.tail.command = tail -f /usr/local/jarsfortest/LogsForTest/generatingLogs-app.logs
agent1.sources.tail.channels = memoryChannel
agent1.sinks.sink1.type = org.apache.flume.sink.hbase.HBaseSink
agent1.sinks.sink1.channel = memoryChannel
agent1.sinks.sink1.table = testFlume
agent1.sinks.sink1.columnFamily = log
agent1.sinks.sink1.serializer = org.apache.flume.sink.hbase.RegexHbaseEventSerializer
agent1.sinks.sink1.serializer.regex = [a-zA-Zo-9]*[^C][a-zA-Z0-9]*[^C][a-zA-Z0-9]*
agent1.sinks.sink1.serializer.regexIgnoreCase = true
agent1.sinks.sink1.serializer.colNames = id, no_fill_reason, bid
agent1.sinks.sink1.channel = memoryChannel
agent1.sinks.sink1.type = logger
agent1.channels.memoryChannel.type = memory
agent1.channels.memoryChannel.capacity = 100
Please Help me..
Thanks in advance
This looks like you have a JVM problem rather than a Flume problem. I'd check that the JAR files are not corrupt, that you haven't set max heap size too small, etc.
Whatever is on the end of this truncated message is probably a clue, the size of the object heap + VM data
Update
agent1.channels.memoryChannel.capacity = 100
That capacity looks very small. I'd remove that line and let it use the default.

Which processes can be launched using performTaskWithPathArgumentsTimeout function?

I use UIAutomation to automate an iPad application. I have tried to use
(object) performTaskWithPathArgumentsTimeout(path, args, timeout) to run Safari.app from my script:
var target = UIATarget.localTarget();
var host = target.host();
var result = host.performTaskWithPathArgumentsTimeout("/Applications/Safari.app", ["http://www.google.com"], 30);
UIALogger.logDebug("exitCode: " + result.exitCode);
UIALogger.logDebug("stdout: " + result.stdout);
UIALogger.logDebug("stderr: " + result.stderr);
I got the following results:
exitCode: 5
stdout:
stderr:
I’ve also tried to launch echo:
var target = UIATarget.localTarget();
var host = target.host();
var result = host.performTaskWithPathArgumentsTimeout("/bin/echo", ["Hello
World"], 5);
UIALogger.logDebug("exitCode: " + result.exitCode);
UIALogger.logDebug("stdout: " + result.stdout);
UIALogger.logDebug("stderr: " + result.stderr);
Results:
exitCode: 0
stdout: Hello World
stderr:
So, looks like performTaskWithPathArgumentsTimeout works for specific applications only.
Could you please help me to answer the following questions:
1. What does exitCode = 5 mean?
2. Which processes can be launched using performTaskWithPathArgumentsTimeout function?
1) Exit code 5 is most likely EIO, as defined in : Input/Output error. You're attempting to execute "/Applications/Safari.app", which to the launching task is a directory and not a binary.
2) You can launch any application with performTaskWithPathArgumentsTimeout() that NSTask can launch. As long as it's a valid executable, it should work.
For your specific example though, Safari won't accept an argument passed on the command line like that as a URL to visit. You need to use open /Applications/Safari.app "http://www.google.com" instead:
var result = host.performTaskWithPathArgumentsTimeout("/usr/bin/open", ["/Applications/Safari.app", "http://www.google.com"], 30);