MarkLogic keeps crashing when I try to run cts.train() function - classification

MarkLogic keeps crashing when I try to run cts.train() function.
Is it my code or something else? Can you help me figure out what's wrong?
MarkLogic Server 8.0-6.4
var labels = []
var voi = cts.collectionQuery(["VehicleOfInterest"])
for(var v in voi)
labels.push({classes:{name:"car"}})
v = cts.search(voi)
var all = [].concat.apply([], [v.toArray()])
var classifier = cts.train( all, labels, {classifierType: "supports", kernel:"simple", epsilon: 0.01} );
Sample node
<?xml version="1.0" encoding="UTF-8"?>
<root>
<RECORD__>1</RECORD__>
<ENTRY_DATE>2/15/2017</ENTRY_DATE>
<EXPIRY_DATE>2/15/2019</EXPIRY_DATE>
<VEHICLE_MAKE>Toyota</VEHICLE_MAKE>
<VEHICLE_MODEL>Corolla</VEHICLE_MODEL>
<VEHICLE_YEAR>2013</VEHICLE_YEAR>
<REGISTRATION>A29302843</REGISTRATION>
<VIN>1234134</VIN>
<LOCATION>MN</LOCATION>
<CLAIM_NUMBER>12345678</CLAIM_NUMBER>
<BACKGROUND___COMMENT>This is a test 1.</BACKGROUND___COMMENT>
<ORIGINAL_SOURCE>INFORMANT</ORIGINAL_SOURCE>
<RISK_CATEGORY>A1</RISK_CATEGORY>
<LINKED_PHONE__>9382938402</LINKED_PHONE__>
</root>
/var/opt/MarkLogic/Logs/ErrorLog.txt
Segmentation fault in thread 0x00007f6739864700
Thread 56 (Thread 0x7f67ec83d700 (LWP 6369)):
#0 0x00007f67e895379b in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0
#1 0x00007f67e895382f in __new_sem_wait_slow.constprop.0 () from /lib64/libpthread.so.0
#2 0x00007f67e89538cb in sem_wait##GLIBC_2.2.5 () from /lib64/libpthread.so.0
#3 0x0000000004322515 in svc::Semaphore::wait ()
#4 0x000000000433f151 in svc::StarterThread::run ()
#5 0x000000000434166e in svc::Thread::top ()
#6 0x00000000043428b9 in runThread ()
#7 0x00007f67e894ddc5 in start_thread () from /lib64/libpthread.so.0
#8 0x00007f67e7d3e6ed in clone () from /lib64/libc.so.6
Thread 55 (Thread 0x7f67ec79f700 (LWP 6377)):
#0 0x00007f67e7d3fb7f in accept4 () from /lib64/libc.so.6
#1 0x000000000433087a in svc::Socket::accept ()
#2 0x000000000402c8bf in xdmp::XDQPServerThread::run ()
#3 0x000000000434166e in svc::Thread::top ()
#4 0x00000000043428b9 in runThread ()
#5 0x00007f67e894ddc5 in start_thread () from /lib64/libpthread.so.0
#6 0x00007f67e7d3e6ed in clone () from /lib64/libc.so.6
Thread 54 (Thread 0x7f67ec780700 (LWP 6378)):
#0 0x00007f67e8954bdd in nanosleep () from /lib64/libpthread.so.0
#1 0x000000000433ed12 in svc::Thread::sleep ()
#2 0x00000000024cffa2 in xdmp::ClusterManager::clusterThread ()
#3 0x000000000434166e in svc::Thread::top ()
#4 0x00000000043428b9 in runThread ()
#5 0x00007f67e894ddc5 in start_thread () from /lib64/libpthread.so.0
#6 0x00007f67e7d3e6ed in clone () from /lib64/libc.so.6
Thread 53 (Thread 0x7f673e7ff700 (LWP 6380)):
#0 0x00007f67e895379b in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0
#1 0x00007f67e895382f in __new_sem_wait_slow.constprop.0 () from /lib64/libpthread.so.0
#2 0x00007f67e89538cb in sem_wait##GLIBC_2.2.5 () from /lib64/libpthread.so.0
#3 0x0000000004322515 in svc::Semaphore::wait ()
#4 0x00000000043445a6 in svc::PooledThread::run ()
#5 0x000000000434166e in svc::Thread::top ()
#6 0x00000000043428b9 in runThread ()
#7 0x00007f67e894ddc5 in start_thread () from /lib64/libpthread.so.0
#8 0x00007f67e7d3e6ed in clone () from /lib64/libc.so.6
...

objects in labels are just in wrong format,
i changed it to something like this and works fine now
labels.push({ "name": "voi doc",
"classes": [
{
"name": 'car',
"val": 1
}
]
})

Related

Getting SEGV / core dumped when running Perl debugger

When I try to run the Perl debugger I'm getting a SEGV error:
Signal SEGV at /opt/csw/lib/perl/csw/Term/ReadLine/Gnu.pm line 240.
Term::ReadLine::Gnu::new("Term::ReadLine", "perldb", GLOB(0x81c1168), GLOB(0x81873a0)) called at /opt/csw/share/perl/5.10.1/perl5db.pl line 6073
DB::setterm called at /opt/csw/share/perl/5.10.1/perl5db.pl line 2237
DB::DB called at -e line 1
Abort (core dumped)
The errors takes place with any Perl code and I think is due to the debugger using Term::ReadLine::Gnu::new.
Using gdb to get the stack trace, I get the following:
Core was generated by `/opt/csw/bin/perl -de$a++'.
Program terminated with signal 6, Aborted.
#0 0xfeaabbc5 in kill () from /lib/libc.so.1
(gdb) bt
#0 0xfeaabbc5 in kill () from /lib/libc.so.1
#1 0xfef0c748 in Perl_apply () from /opt/csw/lib/i386/libperl.so
#2 0xfeeff1ee in Perl_pp_chown () from /opt/csw/lib/i386/libperl.so
#3 0xfeeb6721 in Perl_runops_standard () from /opt/csw/lib/i386/libperl.so
#4 0xfee570da in Perl_call_sv () from /opt/csw/lib/i386/libperl.so
#5 0xfeeac2c8 in Perl_sighandler () from /opt/csw/lib/i386/libperl.so
#6 0xfeea8173 in Perl_csighandler () from /opt/csw/lib/i386/libperl.so
#7 0xfeaa8ecf in __sighndlr () from /lib/libc.so.1
#8 0xfea9eb8f in call_user_handler () from /lib/libc.so.1
#9 <signal handler called>
#10 0xfe82b828 in baudrate () from /lib/libcurses.so.1
#11 0xfe7ede48 in _nc_setupterm () from /opt/csw/lib/libncurses.so.5
#12 0xfe7ee010 in tgetent () from /opt/csw/lib/libncurses.so.5
#13 0xfe88659a in _rl_init_terminal_io () from /opt/csw/lib/i386/libreadline.so.6
#14 0xfe86eb32 in readline_initialize_everything () from /opt/csw/lib/i386/libreadline.so.6
#15 0xfe86ea22 in rl_initialize () from /opt/csw/lib/i386/libreadline.so.6
#16 0xfe8d6e1d in XS_Term__ReadLine__Gnu__XS_rl_initialize () from /opt/csw/lib/perl/csw/auto/Term/ReadLine/Gnu/Gnu.so
#17 0xfeebe7ee in Perl_pp_entersub () from /opt/csw/lib/i386/libperl.so
#18 0xfeeb6721 in Perl_runops_standard () from /opt/csw/lib/i386/libperl.so
#19 0xfee568f1 in S_run_body () from /opt/csw/lib/i386/libperl.so
#20 0xfee56813 in perl_run () from /opt/csw/lib/i386/libperl.so
#21 0x08050b48 in main ()
I would greatly appreciate any help/clues.
Thanks!

Debug Perl Segmentation Fault

I'm using AcePerl to download data from the wormbase.org database.
When I download certain database objects I get (after a certain number of objects) a segmentation fault. This behaviour is reproducible.
I had a look at the core dump and where prints a huge stack of function calls:
#0 0xb763c0ac in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xb763eddc in malloc () from /lib/i386-linux-gnu/libc.so.6
#2 0x080c07ca in Perl_safesysmalloc ()
#3 0x080f3a02 in Perl_sv_grow ()
#4 0x080ebe38 in Perl_sv_setsv_flags ()
#5 0x080ecb76 in Perl_newSVsv ()
#6 0x0811516f in Perl_save_item ()
#7 0x080c7dd8 in Perl_get_db_sub ()
#8 0x080e7a4c in Perl_pp_entersub ()
#9 0x08075570 in Perl_call_sv ()
#10 0x080edd25 in Perl_sv_clear ()
#11 0x080ee3eb in Perl_sv_free2 ()
#12 0x080d79ec in Perl_hv_free_ent ()
#13 0x080d7c8c in ?? ()
#14 0x080db6ff in Perl_hv_undef_flags ()
#15 0x080edf72 in Perl_sv_clear ()
#16 0x080ee3eb in Perl_sv_free2 ()
#17 0x080d79ec in Perl_hv_free_ent ()
#18 0x080d7c8c in ?? ()
#19 0x080db6ff in Perl_hv_undef_flags ()
#20 0x080edf72 in Perl_sv_clear ()
#21 0x080ee3eb in Perl_sv_free2 ()
#22 0x080d79ec in Perl_hv_free_ent ()
#23 0x080d7c8c in ?? ()
#24 0x080db6ff in Perl_hv_undef_flags ()
#25 0x080edf72 in Perl_sv_clear ()
#26 0x080ee3eb in Perl_sv_free2 ()
#27 0x080d79ec in Perl_hv_free_ent ()
#28 0x080d7c8c in ?? ()
#29 0x080db6ff in Perl_hv_undef_flags ()
#30 0x080edf72 in Perl_sv_clear ()
#31 0x080ee3eb in Perl_sv_free2 ()
#32 0x080d79ec in Perl_hv_free_ent ()
#33 0x080d7c8c in ?? ()
#34 0x080db6ff in Perl_hv_undef_flags ()
#35 0x080edf72 in Perl_sv_clear ()
#36 0x080ee3eb in Perl_sv_free2 ()
#37 0x080d79ec in Perl_hv_free_ent ()
#38 0x080d7c8c in ?? ()
#39 0x080db6ff in Perl_hv_undef_flags ()
#40 0x080edf72 in Perl_sv_clear ()
#41 0x080ee3eb in Perl_sv_free2 ()
#42 0x080d79ec in Perl_hv_free_ent ()
#43 0x080d7c8c in ?? ()
#44 0x080db6ff in Perl_hv_undef_flags ()
#45 0x080edf72 in Perl_sv_clear ()
#46 0x080ee3eb in Perl_sv_free2 ()
#47 0x080d79ec in Perl_hv_free_ent ()
#48 0x080d7c8c in ?? ()
#49 0x080db6ff in Perl_hv_undef_flags ()
#50 0x080edf72 in Perl_sv_clear ()
#51 0x080ee3eb in Perl_sv_free2 ()
#52 0x080d79ec in Perl_hv_free_ent ()
#53 0x080d7c8c in ?? ()
...
These function calls are repeated thousands of time.
I also called perl -d:Trace myscript.pl > log but the logfile is about 3 GB large.
Is there a more convenient way to debug this script?
EDIT:
My script: http://paste.ubuntu.com/5564630/ .
My schema file: http://paste.ubuntu.com/5564631/ . It determines which data to download.
The seg fault is raised after ~2300 go_terms.
Install Devel::Trace.
Run your perl script with tracing enabled:
perl -d:Trace myscript.pl >trace 2>&1
Tail the file to see which Perl lines are executed leading up to the segmentation fault.

Getting Image From AlAsset Crashing my App

I have this code in my app:
[[self assetsLibrary] assetForURL:info.media.url resultBlock:^(ALAsset *asset) {
ALAssetRepresentation *rep = [asset defaultRepresentation];
CGImageRef img = [rep fullScreenImage];
photoLayer.contents = img;
} failureBlock:^(NSError *error) {
}];
The code gets to the line where the img variable is populated and stops there and the app locks with no errors. The NSLog echos out a size, so I know the asset is there. I am at a loss as to how to troubleshoot this, it was working before, but has just stopped! Does anyone see anything here that is out of place?
Here is what the url looks like:
assets-library://asset/asset.JPG?id=36E68169-7BB4-48D7-B8E1-244234C9F1DA&ext=JPG
Stack Trace while it is frozen:
Thread 1, Queue : NSManagedObjectContext Queue
#0 0x37b1af38 in syscall_thread_switch ()
#1 0x331a5978 in OSSpinLockLock$VARIANT$wfe ()
#2 0x3318bcae in pthread_once ()
#3 0x348f66e2 in _internalCheckSupportsDCTDownScaling ()
#4 0x348f63fa in _initalizeService ()
#5 0x3318bcde in pthread_once ()
#6 0x348f63ba in jpegService ()
#7 0x3497009c in FigCreateCGImageFromJPEG ()
#8 0x356b5728 in PLCreateImageFromDataWithFormat ()
#9 0x35a3205e in __block_global_0 ()
#10 0x356a03f4 in -[PLAssetsSaver requestSynchronousImageFromAsset:withFormat:completionBlock:] ()
#11 0x35a32028 in __40-[ALAssetRepresentation fullScreenImage]_block_invoke_0 ()
#12 0x35a387ec in __53-[ALAssetRepresentationPrivate _performBlockAndWait:]_block_invoke_0 ()
#13 0x328e79a0 in developerSubmittedBlockToNSManagedObjectContextPerform ()
#14 0x3121c5da in _dispatch_client_callout ()
#15 0x3121f80e in _dispatch_barrier_sync_f_invoke ()
#16 0x328e7b22 in -[NSManagedObjectContext performBlockAndWait:] ()
#17 0x35a351b2 in -[ALAssetsLibrary _performBlockAndWait:] ()
#18 0x35a385ac in -[ALAssetRepresentationPrivate _performBlockAndWait:] ()
#19 0x35a31f24 in -[ALAssetRepresentation fullScreenImage] ()
#20 0x0008a3ca in __31-[MasterTimeLine getPhotoItem:]_block_invoke_0 at /Users/jasoncandelora/Desktop/Glance/iOS/projects/VideoBuilderTest1/VideoBuilderTest1/MasterTimeLine.m:789
#21 0x35a371b2 in __block_global_14 ()
#22 0x3121c792 in _dispatch_call_block_and_release ()
#23 0x3121c5da in _dispatch_client_callout ()
#24 0x3121fe44 in _dispatch_main_queue_callback_4CF ()
#25 0x357ff1b0 in __CFRunLoopRun ()
#26 0x3577223c in CFRunLoopRunSpecific ()
#27 0x357720c8 in CFRunLoopRunInMode ()
#28 0x3702133a in GSEventRunModal ()
#29 0x340ec290 in UIApplicationMain ()
#30 0x0006eda4 in main at /Users/jasoncandelora/Desktop/Glance/iOS/projects/VideoBuilderTest1/VideoBuilderTest1/main.m:16
Thread 3, Queue : com.apple.libdispatch-manager
#0 0x37b1b5d0 in kevent64 ()
#1 0x31221d26 in _dispatch_mgr_invoke ()
#2 0x3121d378 in _dispatch_mgr_thread ()
Thread 5 WebThread, Queue : (null)
#0 0x37b1ae30 in mach_msg_trap ()
#1 0x37b1afd4 in mach_msg ()
#2 0x358002ba in __CFRunLoopServiceMachPort ()
#3 0x357ff030 in __CFRunLoopRun ()
#4 0x3577223c in CFRunLoopRunSpecific ()
#5 0x357720c8 in CFRunLoopRunInMode ()
#6 0x3376ea5c in RunWebThread(void*) ()
#7 0x331950e0 in _pthread_start ()
#8 0x33194fa8 in thread_start ()
Thread 8 com.apple.coremedia.player.async, Queue : (null)
#0 0x37b2b08c in __psynch_cvwait ()
#1 0x3318db00 in _pthread_cond_wait ()
#2 0x33197cfc in pthread_cond_wait ()
#3 0x336ef8b8 in FigSemaphoreWaitRelative ()
#4 0x39b30eae in fpa_AsyncMovieControlThread ()
#5 0x3370d97a in figThreadMain ()
#6 0x331950e0 in _pthread_start ()
#7 0x33194fa8 in thread_start ()
Thread 9 com.apple.coremedia.player.remote, Queue : (null)
#0 0x37b1ae30 in mach_msg_trap ()
#1 0x37b1afd4 in mach_msg ()
#2 0x39b370d8 in FigExpressNotificationThread ()
#3 0x3370d97a in figThreadMain ()
#4 0x331950e0 in _pthread_start ()
#5 0x33194fa8 in thread_start ()
Try moving your final line of code to the main queue:
[[self assetsLibrary] assetForURL:info.media.url resultBlock:^(ALAsset *asset) {
ALAssetRepresentation *rep = [asset defaultRepresentation];
CGImageRef img = [rep fullScreenImage];
dispatch_async(dispatch_get_main_queue(), ^{
photoLayer.contents = img;
};
} failureBlock:^(NSError *error) {
}];
If that doesn't work, how large of an asset is this?
You shouldn't be using this sort of trickery trying to force the asynchronous asset retrieval operations into a synchronous operation. Most likely the reason for this is a deadlock, inspect the stack traces for the various threads and you probably see multiple threads waiting on a semaphore.
I suggest you remove the semaphore locking stuff and let the operation be asynchronous.
Another suggestion: have you made sure that the user actually has permitted access to the photos (new privacy setting on iOS6)?
Regarding the stack output you posted:
I see a FigSemaphoreWaitRelative and OSSpinLockLock$VARIANT$wfe. The first being waiting for a semaphore to be unlocked. The latter being another form of lock while the system apparently checks if the media you are trying to access can be decoded in hardware (_internalCheckSupportsDCTDownScaling).
For some reason this operation not only gets stuck, but it also blocks the main thread which is thread 1. Do you maybe have a media player view open (com.apple.coremedia.player.async) which is blocking the video hardware and this prevents the above DCTDownScaling check to deadlock?
Long story short: sounds like you should file a Radar for this, very much looks like an iOS bug to me.
In my case, I rebooted the device and it is working now.
Thanks for all your help

Random crash in webCore, see call stack, how to debug?

Iphone simulator crash in thread 7 (web thread), app use webview, interact with other views using phoneGap.
Based on XCode 4.2.
#0 0x05841d8a in WebCore::ApplicationCacheGroup::disassociateDocumentLoader ()
#1 0x056879fa in WebCore::ApplicationCacheHost::~ApplicationCacheHost ()
#2 0x0568714f in WebCore::DocumentLoader::~DocumentLoader ()
#3 0x053decb0 in WebDocumentLoaderMac::~WebDocumentLoaderMac ()
#4 0x0579f405 in WebCore::FrameLoader::detachViewsAndDocumentLoader ()
#5 0x0577a542 in WebCore::FrameLoader::detachFromParent ()
#6 0x054414d1 in -[WebView(WebPrivate) _close] ()
#7 0x0459567d in __invoking___ ()
#8 0x04595551 in -[NSInvocation invoke] ()
#9 0x055983c3 in HandleAPISource ()
#10 0x0460601f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#11 0x0456419d in __CFRunLoopDoSources0 ()
#12 0x04563786 in __CFRunLoopRun ()
#13 0x04563240 in CFRunLoopRunSpecific ()
#14 0x04563161 in CFRunLoopRunInMode ()
#15 0x05659423 in RunWebThread ()
#16 0x98305259 in _pthread_start ()
#17 0x983050de in thread_start ()

Xcode malloc error - stack looks weird

I'm using cocos2d and I load all my sprites and scenes before my game. However, once loaded, it seems if I click to start the game too quickly I get this crash:
malloc: *** error for object 0x65cdbb4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
So I did what it suggested, recreated the crash and the stack shows this:
#0 0x9033df7e in malloc_error_break ()
#1 0x9033f128 in szone_error ()
#2 0x9033f29b in free_list_checksum_botch ()
#3 0x9024c186 in tiny_malloc_from_free_list ()
#4 0x9024b2a1 in szone_malloc_should_clear ()
#5 0x9024b148 in malloc_zone_malloc ()
#6 0x90249218 in malloc ()
#7 0x97145617 in operator new ()
#8 0x03adc43f in llvm::User::operator new ()
#9 0x03aab18f in llvm::CastInst::Create ()
#10 0x0341394c in llvm::BitcodeReader::ParseFunctionBody ()
#11 0x034164fe in llvm::BitcodeReader::materializeFunction ()
#12 0x0cd72472 in glvmAddOperation ()
#13 0x0cd4c752 in gleBuildVertexSubmitFunc ()
#14 0x0cd74e0c in cvmsModularBuilder ()
#15 0x03392a67 in cvmsCompBuildModularFunction ()
#16 0x033970a8 in cvmsServerBuildModularFunction ()
#17 0x03394e26 in CVMSBuildModularFunction ()
#18 0x032b0c26 in glvm_deferred_build_modular ()
#19 0x03310404 in glvmDoWork ()
#20 0x902747fd in _pthread_start ()
#21 0x90274682 in thread_start ()
None of these functions listed are mine, any ideas? Thanks.