unfortunately, Groceries has stopped - nativescript

I am trying to start sample-Groceries from here http://docs.nativescript.org/angular/tutorial/ng-chapter-1 on android emulator and get the following message "unfortunately, Groceries has stoped"
Here is the debug messages from console
I/DEBUG ( 1142): #12 pc 005c13b1 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::CompileIrregexp(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, bool)+673)
I/DEBUG ( 1142): #13 pc 005c1605 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>)+165)
I/DEBUG ( 1142): #14 pc 005c1b23 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+51)
I/DEBUG ( 1142): #15 pc 005c1cd0 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::Exec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+144)
I/DEBUG ( 1142): #12 pc 005c13b1 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::CompileIrregexp(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, bool)+673)
I/DEBUG ( 1142): #13 pc 005c1605 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>)+165)
I/DEBUG ( 1142): #14 pc 005c1b23 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+51)
I/DEBUG ( 1142): #15 pc 005c1cd0 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::Exec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+144)
I/DEBUG ( 1142): #12 pc 005c13b1 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::CompileIrregexp(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, bool)+673)
I/DEBUG ( 1142): #13 pc 005c1605 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>)+165)
I/DEBUG ( 1142): #14 pc 005c1b23 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+51)
I/DEBUG ( 1142): #15 pc 005c1cd0 /data/app/org.nativescript.groceries-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::Exec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+144)
I tried to use Genymotion and native android emulator
Ubuntu 16.04 node.js 4.5.0
tns --version 2.2.1

I reviewed the given scenario, however I was unable to reproduce such a problem with the getting started project and new created projects. Could you follow the below attached steps to verify whether this helps.
tns create sampleProject --ng
manually start android emulator
tns prepare android
run tns run android

Related

GDB not showing symbols of stripped core files even if a non-stripped version is given

I built the program by classic configure, make, make install. Some months after, the program crashed. I still have the build directory where both the source and the non-stripped executable reside. From there, I call gdb like so:
530-north:courier$ gdb -q --core /tmp/core_epoch\=1667475742_pid\=23653_file\=\!usr\!local\!libexec\!courier\!courierd courierd
Reading symbols from courierd...
[New LWP 23653]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/local/libexec/courier/courierd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000561e841e5afd in msgq::completed(drvinfo&, unsigned long) ()
(gdb) info args
No symbol table info available.
With bt I can see a long sequence of calls between two functions:
#0 0x0000561e841e5afd in msgq::completed(drvinfo&, unsigned long) ()
#1 0x0000561e841e609a in msgq::startdelivery(drvinfo*, delinfo*) ()
#2 0x0000561e841e5bd8 in msgq::completed(drvinfo&, unsigned long) ()
#3 0x0000561e841e609a in msgq::startdelivery(drvinfo*, delinfo*) ()
#4 0x0000561e841e5bd8 in msgq::completed(drvinfo&, unsigned long) ()
...
#204 0x0000561e841e5a17 in msgq::completed(drvinfo&, unsigned long) ()
#205 0x0000561e841e609a in msgq::startdelivery(drvinfo*, delinfo*) ()
#206 0x0000561e841e5a17 in msgq::completed(drvinfo&, unsigned long) ()
#207 0x0000561e841e70fe in courierbmain() ()
#208 0x0000561e841dd030 in main ()
Every couple of calls advances the stack by 0x110, for a total of ~27Kb, which is much less of the running processes' allocated 132Kb of stack, so it's not stack overflow. SIGSEGV could be from a null pointer or whatever. Why doesn't gdb point at it? This is GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git, BTW.
If I omit the last argument to gdb, bt doesn't show the function names. Did I screw up compilation? On config.log I see I had 'CFLAGS= -march=nocona -O2 -g' 'LDFLAGS= -march=nocona -O2' 'CXXFLAGS= -march=nocona -O2 -std=c++11'. The source file is C++. Perhaps I missed some -gs? Yet, some symbols are there...
Why doesn't gdb point at it?
Because you haven't compiled your program with appropriate debug info.
You'll have to debug this crash at the assembly level. Start with disasemble $pc and info registers.
The source file is C++. Perhaps I missed some -gs?
Yes: your CXXFLAGS don't have -g.
Yet, some symbols are there...
On UNIX systems (unlike Windows), function names (symbols) are present (by default) even without -g. There is no contradiction here.
Update:
However, if I don't pass the non-stripped file as argument, the function names are not displayed.
Yes: strip removes the symbols and debug info.
You can observe this by using a trivial test:
// t.cc
#include <cstdlib>
struct S {
void fn() { abort(); }
};
int main()
{
S().fn();
}
First let's see how it works when the binary is built correctly for debugging:
g++ -g t.cc -o a.out && strip ./a.out -o a.out.stripped &&
./a.out.stripped; gdb -q --batch -ex where ./a.out core
Aborted (core dumped)
...
warning: core file may not match specified executable file.
[New LWP 476070]
Core was generated by `./a.out.stripped'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007f12444895df in __pthread_kill_internal (signo=<optimized out>, threadid=<optimized out>) at ./nptl/pthread_kill.c:89
#2 __GI___pthread_kill (threadid=<optimized out>, signo=<optimized out>) at ./nptl/pthread_kill.c:89
#3 0x00007f12445f5e70 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007f1244428469 in __GI_abort () at ./stdlib/abort.c:79
#5 0x000055de28a24165 in S::fn (this=0x7ffcd0d1d80f) at t.cc:4
#6 0x000055de28a2414d in main () at t.cc:9
Note presence of file/line info and function names. If we use the stripped version, neither is present:
ore was generated by `./a.out.stripped'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007f12444895df in __pthread_kill_internal (signo=<optimized out>, threadid=<optimized out>) at ./nptl/pthread_kill.c:89
#2 __GI___pthread_kill (threadid=<optimized out>, signo=<optimized out>) at ./nptl/pthread_kill.c:89
#3 0x00007f12445f5e70 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007f1244428469 in __GI_abort () at ./stdlib/abort.c:79
#5 0x000055de28a24165 in ?? ()
#6 0x000055de28a2414d in ?? ()
#7 0x00007f124442920a in __libc_start_call_main (main=main#entry=0x55de28a24139, argc=argc#entry=1, argv=argv#entry=0x7ffcd0d1d928) at ../sysdeps/nptl/libc_start_call_main.h:58
#8 0x00007f12444292bc in __libc_start_main_impl (main=0x55de28a24139, argc=1, argv=0x7ffcd0d1d928, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffcd0d1d918) at ../csu/libc-start.c:389
#9 0x000055de28a24071 in ?? ()
Now let's repeat with incorrectly built binary (which is what you have):
g++ t.cc -o b.out && strip ./b.out -o b.out.stripped &&
./b.out.stripped; gdb -q --batch -ex where ./b.out core
Aborted (core dumped)
...
warning: core file may not match specified executable file.
[New LWP 478614]
Core was generated by `./b.out.stripped'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007f21a0a895df in __pthread_kill_internal (signo=<optimized out>, threadid=<optimized out>) at ./nptl/pthread_kill.c:89
#2 __GI___pthread_kill (threadid=<optimized out>, signo=<optimized out>) at ./nptl/pthread_kill.c:89
#3 0x00007f21a0bf5e70 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007f21a0a28469 in __GI_abort () at ./stdlib/abort.c:79
#5 0x000056049b052165 in S::fn() ()
#6 0x000056049b05214d in main ()
Notice presence of function names (S::fn(), main) but lack of file/line/argument info. This matches your observed result.
If you try again with b.out.stripped, you'll get the same result as you had from previous run with a.out.stripped:
Core was generated by `./b.out.stripped'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=no_tid#entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007f21a0a895df in __pthread_kill_internal (signo=<optimized out>, threadid=<optimized out>) at ./nptl/pthread_kill.c:89
#2 __GI___pthread_kill (threadid=<optimized out>, signo=<optimized out>) at ./nptl/pthread_kill.c:89
#3 0x00007f21a0bf5e70 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007f21a0a28469 in __GI_abort () at ./stdlib/abort.c:79
#5 0x000056049b052165 in ?? ()
#6 0x000056049b05214d in ?? ()
#7 0x00007f21a0a2920a in __libc_start_call_main (main=main#entry=0x56049b052139, argc=argc#entry=1, argv=argv#entry=0x7fff3554bc78) at ../sysdeps/nptl/libc_start_call_main.h:58
#8 0x00007f21a0a292bc in __libc_start_main_impl (main=0x56049b052139, argc=1, argv=0x7fff3554bc78, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff3554bc68) at ../csu/libc-start.c:389
#9 0x000056049b052071 in ?? ()
In addition, readelf --debug-dump=info courierd shows lots of Version 4 stuff.
Yes, if you run readelf --debug-dump b.out, you could observe a lot of DWARF4 stuff coming from crt0.o, crtbegin.o, etc (depending on how your GCC and GLIBC were built).
If you have .c files linked in, these will also have DWARF4 debug info, since your CFLAGS do include -g.
But none of the DWARF4 stuff will be coming from wherever msgq::completed is defined.

segmentation fault in QTextDocument::print

I met a very strange segfault and I does not understand the cause.
Context: in a console QT application, I need to create a PDF file containing some information but the PDF generation causes a segmentation fault.
I reduced the initial code to the main function and a method.
The qt .pro file:
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
QT += core
QT += gui # need for pdf generation
QT += printsupport #need for pdf generation
main.cpp
int main(int argc, char *argv[])
{
QCoreApplication::setSetuidAllowed(true);
QCoreApplication app(argc, argv);
CPdfCreationDryRun pdfCreate(&app);
QTimer::singleShot(0, &pdfCreate, SLOT(start()));
return app.exec();
}
test.cpp
void CPdfCreationDryRun::start()
{
QTextDocument doc {};
const QString msg {"<p>toto</p>"};
doc.setHtml(msg);
const QString pdfFileName {"toto.pdf"};
QPrinter printer {QPrinter::PrinterResolution};
printer.setPageSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(pdfFileName);
printer.setFontEmbeddingEnabled(true);
doc.print(&printer);
}
gdb backtrace
#0 0x00007f5cfec7bc42 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#1 0x00007f5cfec7f2cd in QFontDatabase::findFont(QFontDef const&, int) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#2 0x00007f5cfec7faf6 in QFontDatabase::load(QFontPrivate const*, int) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#3 0x00007f5cfec553b3 in QFontPrivate::engineForScript(int) const () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#4 0x00007f5cfec86cf9 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#5 0x00007f5cfeca0006 in QTextLine::layout_helper(int) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#6 0x00007f5cfeca1840 in QTextLine::setLineWidth(double) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#7 0x00007f5cfece4d3d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#8 0x00007f5cfece5845 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#9 0x00007f5cfeceac3d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007f5cfeceb0b9 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#11 0x00007f5cfeceb2b8 in QTextDocumentLayout::doLayout(int, int, int) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007f5cfecebde1 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#13 0x00007f5cfecec789 in QTextDocumentLayout::documentChanged(int, int, int) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007f5cfecb6bc6 in QTextDocument::documentLayout() const () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#15 0x00007f5cfecbe1ed in QTextDocument::print(QPagedPaintDevice*) const () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#16 0x0000559445993520 in CPdfCreationDryRun::start (this=0x7ffc7ea14be0) at
valgrind logs:
==82570== Invalid read of size 8
==82570== at 0x54A8C42: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54AC2CC: QFontDatabase::findFont(QFontDef const&, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54ACAF5: QFontDatabase::load(QFontPrivate const*, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54823B2: QFontPrivate::engineForScript(int) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54B7617: QTextEngine::fontEngine(QScriptItem const&, QFixed*, QFixed*, QFixed*) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54B8708: QTextEngine::shapeText(int) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54B93EE: QTextEngine::shape(int) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54CDDFB: QTextLine::layout_helper(int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54CE83F: QTextLine::setLineWidth(double) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x5511D3C: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x5512844: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x5517C3C: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==82570==
==82570==
==82570== Process terminating with default action of signal 11 (SIGSEGV)
==82570== Access not within mapped region at address 0x0
==82570== at 0x54A8C42: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54AC2CC: QFontDatabase::findFont(QFontDef const&, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54ACAF5: QFontDatabase::load(QFontPrivate const*, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54823B2: QFontPrivate::engineForScript(int) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54B7617: QTextEngine::fontEngine(QScriptItem const&, QFixed*, QFixed*, QFixed*) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54B8708: QTextEngine::shapeText(int) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54B93EE: QTextEngine::shape(int) const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54CDDFB: QTextLine::layout_helper(int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x54CE83F: QTextLine::setLineWidth(double) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x5511D3C: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x5512844: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
==82570== by 0x5517C3C: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5)
I tried to redefine QT_QPA_FONTDIR env variable to different directories containing fonts but this did not change the behavior.
EDIT1: I tried without "printer.setFontEmbeddingEnabled()" and it did not change the behavior.
EDIT2: The doc variable content:
doc.toHtml: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style></head><body style=\" font-family:''; font-weight:400; font-style:normal;\">\n<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">toto</p></body></html>"
doc.toPlainText: "toto"
doc.toRaw: "toto"
Host configuration:
Linux ubuntu 4.18.0-25-generic #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
g++ --version
g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
QT: 5.9.5-0ubuntu1
I am looking for any helps to understand the observed behavior and how to fix it.
Thanks & regards,
I found a workaround: I replaced
QCoreApplication
per
QApplication
then rebuilt... And it works :'(

async Task timing out

I am writing a page in Xamarin that displays a YouTube search using the YouTube Data API. It compiles fine but when I run it on my Android device it freezes and after awhile prompts to quit the application because it's not responding. I think it has something to do with establsihing the YouTubeService object.
This basically calls the data API and loads 50 of the videos for the given search term into the listview
private async Task Run()
{
videoList.Clear();
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = DEVELOPER_KEY,
ApplicationName = "Xamarin-Basics"
});
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.Q = "mkbhd";
searchListRequest.MaxResults = 50;
var searchListResponse = await searchListRequest.ExecuteAsync();
foreach(var searchResult in searchListResponse.Items)
{
if (searchResult.Id.Kind.Equals("youtube#video"))
{
videoList.Add(new VideoInfo(searchResult.Snippet.Title, searchResult.Snippet.Description));
}
}
}
Also, here is the stack trace which appears to be running the operation in the thread over and over again:
09-15 20:31:21.352 D/Mono ( 6831): Assembly Ref addref Newtonsoft.Json[0xb72c8210] -> System.Linq.Expressions[0xb72e98a0]: 3
Loaded assembly: Anonymously Hosted DynamicMethods Assembly [External]
09-15 20:31:21.562 D/Mono ( 6831): Assembly Ref addref Google.Apis.YouTube.v3[0xb72c7310] -> Newtonsoft.Json[0xb72c8210]: 4
09-15 20:31:22.127 D/Mono ( 6831): DllImport searching in: '__Internal' ('(null)').
09-15 20:31:22.127 D/Mono ( 6831): Searching for 'CloseZStream'.
09-15 20:31:22.127 D/Mono ( 6831): Probing 'CloseZStream'.
09-15 20:31:22.127 D/Mono ( 6831): Found as 'CloseZStream'.
09-15 20:31:31.950 D/Mono ( 6831): [0xb76fa5b0] worker finishing
Thread finished: <Thread Pool> #3
The thread 'Unknown' (0x3) has exited with code 0 (0x0).
09-15 20:31:57.148 D/Mono ( 6831): [0xb808e9b8] worker finishing
Thread finished: <Thread Pool> #7
The thread 'Unknown' (0x7) has exited with code 0 (0x0).
09-15 20:32:04.446 D/Mono ( 6831): [0xb77219d8] worker finishing
Thread finished: <Thread Pool> #4
The thread 'Unknown' (0x4) has exited with code 0 (0x0).
Thread finished: <Thread Pool> #2
The thread 'Unknown' (0x2) has exited with code 0 (0x0).
09-15 20:32:49.051 D/Mono ( 6831): [0xb808de40] worker finishing
Thread finished: <Thread Pool> #8
The thread 'Unknown' (0x8) has exited with code 0 (0x0).
Thread started: <Thread Pool> #11
Thread started: <Thread Pool> #12
09-15 20:32:59.725 D/Mono ( 6831): [0xb81d8738] worker starting
09-15 20:33:30.573 D/Mono ( 6831): [0xb81d8738] worker finishing
Thread finished: <Thread Pool> #12
The thread 'Unknown' (0xc) has exited with code 0 (0x0).
09-15 20:33:46.394 D/Mono ( 6831): [0xb80a4790] worker finishing
Thread finished: <Thread Pool> #9
The thread 'Unknown' (0x9) has exited with code 0 (0x0).
Thread finished: <Thread Pool> #11
The thread 'Unknown' (0xb) has exited with code 0 (0x0).
Thread started: <Thread Pool> #13
Thread started: <Thread Pool> #14
09-15 20:34:39.731 D/Mono ( 6831): [0xb81d8738] worker starting
Thread started: <Thread Pool> #15
09-15 20:34:39.749 D/Mono ( 6831): [0xb84d0f60] worker starting
09-15 20:34:52.494 D/Mono ( 6831): [0xb84d0f60] worker finishing
Thread finished: <Thread Pool> #15
The thread 'Unknown' (0xf) has exited with code 0 (0x0).
Your code looks basically right. I am assuming you are using the latest v3 api:
Google.Apis.YouTube.v3" version="1.16.0.582"
I would try wrapping the whole routine in a try/catch just to make sure that you are not getting a 403 or other access/auth error:
Xamarin.Android example:
try
{
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = DEVELOPER_KEY,
ApplicationName = "com.sushihangover.youtubeapi",
});
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.Q = "StackOverflow";
searchListRequest.MaxResults = 50;
var searchListResponse = await searchListRequest.ExecuteAsync();
foreach (var searchResult in searchListResponse.Items)
{
if (searchResult.Id.Kind.Equals("youtube#video"))
{
Console.WriteLine(searchResult.Snippet.Title);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

Segmentation fault on using boost syslog and cpp-netlib

After adding boost syslog into source code, segmentation fault appears inside cpp-netlib library.
I was able to prepare minimum working code snippet to reproduce the problem.
#include <boost/network/protocol/http/client.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/sinks/syslog_backend.hpp>
#include <iostream>
using namespace boost::network;
using namespace boost::network::http;
namespace sinks = boost::log::sinks;
int main()
{
client::request request_("http://www.boost.org/");
client client_;
client::response response_ = client_.get(request_);
std::string body_ = body(response_);
std::cout << "body: " << body_;
using syslog_sinkT = sinks::synchronous_sink <sinks::syslog_backend>;
boost::shared_ptr <sinks::syslog_backend> backend = boost::make_shared <sinks::syslog_backend> ();
boost::shared_ptr<syslog_sinkT> sink = boost::make_shared <syslog_sinkT> (backend);
}
When last 2 lines are commented, segmentation fault disappears and everything works fine.
gdb stack trace (approximately, may vary):
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7c29b40 (LWP 19874)]
0x00000000 in ?? ()
(gdb) where
#0 0x00000000 in ?? ()
#1 0x083c376c in boost::asio::detail::task_io_service_operation::complete (bytes_transferred=260, ec=..., owner=...,
this=0xf6900710)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/asio/detail/task_io_service_o$
eration.hpp:38
#2 boost::asio::detail::task_io_service::do_run_one (ec=..., this_thread=..., lock=..., this=<optimized out>)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/asio/detail/impl/task_io_serv$
ce.ipp:372
#3 boost::asio::detail::task_io_service::run (ec=..., this=0x84ea280)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/asio/detail/impl/task_io_serv$
ce.ipp:149
#4 boost::asio::io_service::run (this=0x84e9a94)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/asio/impl/io_service.ipp:59
#5 0x083b5766 in boost::_mfi::mf0<unsigned int, boost::asio::io_service>::operator() (p=<optimized out>, this=<optimized out>)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/bind/mem_fn_template.hpp:49
#6 boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> >::operator()<unsigned int, boost::_mfi::mf0<unsigned int, boost::a$
io::io_service>, boost::_bi::list0> (a=<synthetic pointer>, f=..., this=0x84ea94c)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/bind/bind.hpp:249
#7 boost::_bi::bind_t<unsigned int, boost::_mfi::mf0<unsigned int, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boo$
t::asio::io_service*> > >::operator() (this=0x84ea944)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/bind/bind.hpp:1222
#8 boost::detail::thread_data<boost::_bi::bind_t<unsigned int, boost::_mfi::mf0<unsigned int, boost::asio::io_service>, boost::_bi::$
ist1<boost::_bi::value<boost::asio::io_service*> > > >::run (this=0x84ea828)
at /home/kostidov/prj/third_party-master/boost/boost_1_60_0/__public__/v0/Linux-libc6/include/boost/thread/detail/thread.hpp:116
#9 0x0840a4f8 in boost::(anonymous namespace)::thread_proxy (param=0x84ea828) at libs/thread/src/pthread/thread.cpp:167
#10 0xf7de1f70 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#11 0xf7d18bee in clone () from /lib/i386-linux-gnu/libc.so.6
Problem exists on Ubuntu 14.04 with cpp-netlib 0.11.2 and both boost versions 1_58_0 and 1_60_0. Boost, cpp-netlib and my application are compiled with -std=c++11.
Note 1. Segmentation fault appears inside cpp-netlib before reaching syslog_backend creation. Only presence of last 2 lines guarantees SIGSEGV reproduction.
Note 2. Reproduces only with syslog_backend. Any other logging targets (file, consol) work fine.
The best idea I have is the problem may lay inside boost during static variables initialisation, but I have no proves regarding this version.
Any suggestions?
Seems like I used too many compile options for building both boost and cpp-netlib.
I prepared new build for both boost and cpp-netlib once again, but this time I used as less additional options as possible.
And it works fine.
EDIT: I found the key which causes the error. It's BOOST_ASIO_ENABLE_HANDLER_TRACKING It was defined during the boost compilation, but wasn't defined during compilation of cpp-netlib and my application.
https://svn.boost.org/trac/boost/ticket/11945

Cocoa webview garbage collection, crashing when loading

I have this web view connected via IB in a garbage collected project. I can load a url perfectly fine in the web view one time, but then anytime after that one time it seems to crash randomly. I've got a couple different errors, a few specifically referencing garbage collection and saying EXC_BAD_ACCESS... the most recent and common though is this:
Thread 1, Queue : com.apple.main-thread
#0 0x00007fff8b4ffe90 in objc_msgSend ()
#1 0x00000004001ae2c0 in <????> ()
#2 0x00007fff97ab1313 in _NSURLConnectionDidReceiveData ()
#3 0x00007fff93e22388 in URLConnectionClient::_clientDidReceiveData(__CFArray const*, URLConnectionClient::ClientConnectionEventQueue*) ()
#4 0x00007fff93ed3c5b in URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) ()
#5 0x00007fff93dfeb49 in URLConnectionClient::processEvents() ()
#6 0x00007fff93dfe9ee in MultiplexerSource::perform() ()
#7 0x00007fff8fd666e1 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#8 0x00007fff8fd65f4d in __CFRunLoopDoSources0 ()
#9 0x00007fff8fd8cd39 in __CFRunLoopRun ()
#10 0x00007fff8fd8c676 in CFRunLoopRunSpecific ()
#11 0x00007fff97a54f9f in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#12 0x00007fff954861a2 in WebCore::ResourceHandle::loadResourceSynchronously(WebCore::NetworkingContext*, WebCore::ResourceRequest const&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, WTF::Vector<char, 0ul>&) ()
#13 0x00007fff95485c1f in WebCore::FrameLoader::loadResourceSynchronously(WebCore::ResourceRequest const&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, WTF::Vector<char, 0ul>&) ()
#14 0x00007fff9548583b in WebCore::DocumentThreadableLoader::loadRequest(WebCore::ResourceRequest const&, WebCore::SecurityCheckPolicy) ()
#15 0x00007fff95485376 in WebCore::DocumentThreadableLoader::DocumentThreadableLoader(WebCore::Document*, WebCore::ThreadableLoaderClient*, WebCore::DocumentThreadableLoader::BlockingBehavior, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderOptions const&, WTF::String const&) ()
#16 0x00007fff95485220 in WebCore::DocumentThreadableLoader::loadResourceSynchronously(WebCore::Document*, WebCore::ResourceRequest const&, WebCore::ThreadableLoaderClient&, WebCore::ThreadableLoaderOptions const&) ()
#17 0x00007fff95485076 in WebCore::XMLHttpRequest::createRequest(int&) ()
#18 0x00007fff95484d07 in WebCore::XMLHttpRequest::send(WTF::String const&, int&) ()
#19 0x00007fff95484807 in WebCore::XMLHttpRequest::send(int&) ()
#20 0x00007fff954844e7 in WebCore::JSXMLHttpRequest::send(JSC::ExecState*) ()
#21 0x00007fff95484432 in WebCore::jsXMLHttpRequestPrototypeFunctionSend(JSC::ExecState*) ()
#22 0x00004f57b12011e8 in <????> ()
#23 0x00007fff900b778b in JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::ScopeChainNode*, JSC::JSObject*) ()
#24 0x000000010c2e4da0 in <????> ()
#25 0x000000010a3f76a0 in <????> ()
#26 0x00007fff90286700 in JSC::JSFunction::~JSFunction() ()
#27 0x4810c08348eba9ab in <????> ()
I really don't know what to do. The crashing is sporadic and sometimes I can load the web view a few times before it crashes the app...
Also I've been getting this one a lot:
Thread 10, Queue : Garbage Collection Work Queue
#0 0x00007fff90168f6f in auto_fatal ()
#1 0x00007fff9017713b in Auto::Zone::handle_overretained_garbage(void*, int, int) ()
#2 0x00007fff90177844 in Auto::Zone::free_garbage(unsigned long, void**, unsigned long, void**, unsigned long&, unsigned long&) ()
#3 0x00007fff90164837 in auto_collect_internal(Auto::Zone*, unsigned int) ()
#4 0x00007fff9016021a in __auto_zone_collect_block_invoke_0 ()
#5 0x00007fff954098ba in _dispatch_call_block_and_release ()
#6 0x00007fff9540b10a in _dispatch_queue_drain ()
#7 0x00007fff9540af66 in _dispatch_queue_invoke ()
#8 0x00007fff9540a760 in _dispatch_worker_thread2 ()
#9 0x00007fff91adf3da in _pthread_wqthread ()
#10 0x00007fff91ae0b85 in start_wqthread ()

Resources