.. index::
single: FAQ; application crash
.. _faq-crash:
My application crashes. What can I do?
======================================
Does it crash at the beginning or at the end?
---------------------------------------------
Check if Nanos++ was built with the **allocator disabled**.
Get a backtrace
---------------
The first step would be to obtain a **backtrace** using ``gdb``.
(see `GNU GDB website `_).
Ways to run gdb
^^^^^^^^^^^^^^^
A typical approach could be::
$ gdb --args program parameters
If your applications needs some ``NX_ARGS`` you can pass them like this::
$ NX_ARGS="..." gdb --args program parameters
or set in the environment using ``export`` or ``setenv`` as usual before running ``gdb``.
If you are running in a batch queue (not interactively) you will have to use ``gdb``
in batch mode. Pass the flags ``--batch`` and ``-ex`` like this::
$ NX_ARGS="..." gdb --batch -ex "run" -ex "some-gdb-command" program parameters
You may pass more than one ``-ex`` command and they will be run sequentially.
Instead of ``-ex`` you may write the commands in a file and pass the parameter ``--command``.
Check the `GNU GDB documentation `_.
Backtrace
^^^^^^^^^
Once the program crashes inside ``gdb`` it is time to get a backtrace. If your
program has more than one thread the usual ``backtrace`` (or its short form
``bt``) will not give all the information we want. Make sure you use ``thread
apply all backtrace`` command (or its short form ``thread apply all bt``).
If you are running in batch, your command will look as follows::
$ NX_ARGS="..." gdb --batch -ex "run" -ex "thread apply all bt" program parameters
I cannot get a backtrace
------------------------
If there is no backtrace, this can be a symptom of a **low stack size**.
You can increase it with *NX_STACK_SIZE* (see :ref:`running-ompss-programs`).
If this does not solve your problem, we suggest to follow these steps:
* Comment all tasks.
* Run with only one thread.
* Activate the tasks again, but follow them by a ``#pragma omp taskwait``
* Remove the unneeded ``taskwait`` one by one.
* Increase the number of threads.
Chances are that you will be able to diagnose your problem after one of these steps.