I am attempting a build of one of our GUI projects. This build works on every machine in the office save the two new machines. Here is the terminal output of the error:
viewPriorityChanged( 11, 0 )
viewPriorityChanged( 12, 0 )
viewPriorityChanged( 13, 0 )
MainWindow.cpp debug print #5
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
./runlp_common: line 320: 11123 Aborted (core dumped) $3
As you can see I have traced it down in the code with print statements. Here is the method that is erring in the code:
void MainWindow::updateDecoration()
{
Geometry::DisplayTypes closest = Geometry::closestDisplayType();
QString closestStr = Geometry::displayTypeString(closest).toLower();
QString iconPath = QString(QLatin1String(":/images/device_skin_%1.png")).
arg(closestStr);
Messages::conout() << "MainWindow.cpp debug print #5" << std::endl;
m_device = QPixmap(iconPath); <-- not making it past here
Messages::conout() << "MainWindow.cpp debug print #6" << std::endl;
QBitmap clBitmap = m_device.createHeuristicMask();
setFixedSize(m_device.size());
setMask(clBitmap);
update();
}
It is the strangest thing (in my opinion) that this line would be causing just a few machines trouble. Any ideas what could be going on here?
EDIT:
I wanted to give a more detailed description of the terminal output:
MainWindow.cpp debug print #1
MainWindow.cpp debug print #2
ToolsViewConfigTip_Series: Preloading tip images
ToolsViewConfigTip_Capacity: Preloading tip images.
ln: cannot remove '/etc/localtime': Permission denied
Using QGLBridge
Using QGLBridge
QThread::start: Thread creation error: Resource temporarily unavailable
libpng error: Read Error
libpng error: Read Error
libpng error: Read Error
libpng error: Read Error
libpng error: Read Error
libpng error: Read Error
libpng error: Read Error
libpng error: Read Error
QImage::scaled: Image is a null image
viewPriorityChanged( 0, 0 )
viewPriorityChanged( 1, 0 )
viewPriorityChanged( 2, 0 )
viewPriorityChanged( 3, 0 )
viewPriorityChanged( 4, 0 )
viewPriorityChanged( 5, 0 )
viewPriorityChanged( 6, 0 )
viewPriorityChanged( 7, 0 )
viewPriorityChanged( 10, 0 )
viewPriorityChanged( 11, 0 )
viewPriorityChanged( 12, 0 )
viewPriorityChanged( 13, 0 )
MainWindow.cpp debug print #4
MainWindow.cpp debug print #5
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
./runlp_common: line 320: 22676 Aborted (core dumped) $3
----------- KillAllApps -----------
IsobusMuxServer::clientDisconnected() Client 1 is now disconnected and destroyed
IsobusMuxServer::clientDisconnected() Client 0 is now disconnected and destroyed
-----------------------------------
I took the suggestion about using valgrind in the comments. Prior to this point in the program there actually are no alllocs, frees and no bytes are allocated. I tried running the other various tools in the valgrind package without any luck. The only other error I get is when running helgrind:
ProprietarySocketServer::startServer() bind: Address already in use
ProprietarySocketServer::startServer() Could not bind on port 41263
Related
I'm trying to load a simple four-layer convolutional neural network from an ONNX file in C++ with OpenCV. The ONNX file was created from a TensorFlow model using the tf2onnx library in Python. I saved the model with the following piece of code.
(onnx_model_proto, storage) = tf2onnx.convert.from_keras(model, opset=8)
with open(os.path.join("models", 'upscaleModelData.onnx'), "wb") as f:
f.write(onnx_model_proto.SerializeToString())
When reading via cv::dnn::Net net = cv::dnn::readNetFromONNX("model.onnx"); in C++, I get the following error.
[ INFO:0] global ####\master_winpack-build-win64-vc15\opencv\modules\dnn\src\onnx\onnx_importer.cpp (429) cv::dnn::dnn4_v20210608::ONNXImporter::populateNet DNN/ONNX: loading ONNX v4 model produced by 'tf2onnx':1.10.0. Number of nodes = 13, inputs = 1, outputs = 1
OpenCV(4.5.3) Error: Unspecified error (Can't create layer "model/tf.nn.depth_to_space/DepthToSpace:0" of type "DepthToSpace") in cv::dnn::dnn4_v20210608::LayerData::getLayerInstance, file ####\opencv\modules\dnn\src\dnn.cpp, line 621
[ERROR:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2127) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [DepthToSpace]:(model/tf.nn.depth_to_space/DepthToSpace:0)
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2131) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Input[0] = 'model/conv2d_3/Relu:0'
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2135) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Output[0] = 'model/tf.nn.depth_to_space/DepthToSpace:0'
OpenCV(4.5.3) Error: Unspecified error (> Node [DepthToSpace]:(model/tf.nn.depth_to_space/DepthToSpace:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\dnn.cpp:621: error: (-2:Unspecified error) Can't create layer "model/tf.nn.depth_to_space/DepthToSpace:0" of type "DepthToSpace" in function 'cv::dnn::dnn4_v20210608::LayerData::getLayerInstance'
> ) in cv::dnn::dnn4_v20210608::ONNXImporter::handleNode, file ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 2146
OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:2146: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
> Node [DepthToSpace]:(model/tf.nn.depth_to_space/DepthToSpace:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\dnn.cpp:621: error: (-2:Unspecified error) Can't create layer "model/tf.nn.depth_to_space/DepthToSpace:0" of type "DepthToSpace" in function 'cv::dnn::dnn4_v20210608::LayerData::getLayerInstance'
I'm using OpenCV on Windows and Visual C++.
This might be a similar issue to this: EMGU - EDSR : Can't create layer DepthToSpace.
I tried reading the same network from TensorFlow PB and H5 file, but I get a similar result.
For reading a PB file, created with cv::dnn::readNetFromTensorflow("model.pb") I get:
OpenCV(4.5.3) Error: Unspecified error (FAILED: fs.is_open(). Can't open "model.pb") in cv::dnn::ReadProtoFromBinaryFile, file ####\opencv\modules\dnn\src\caffe\caffe_io.cpp, line 1133
OpenCV(4.5.3) ####\opencv\modules\dnn\src\caffe\caffe_io.cpp:1133: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "model.pb" in function 'cv::dnn::ReadProtoFromBinaryFile'
For reading a H5 file created with cv::dnn::readNetFromTensorflow("upscaleModelData.h5"); I get:
OpenCV(4.5.3) Error: Unspecified error (Cannot determine an origin framework of files: model.h5) in cv::dnn::dnn4_v20210608::readNet, file ####\opencv\modules\dnn\src\dnn.cpp, line 5461
OpenCV(4.5.3) ####\opencv\modules\dnn\src\dnn.cpp:5461: error: (-2:Unspecified error) Cannot determine an origin framework of files: model.h5 in function 'cv::dnn::dnn4_v20210608::readNet'
Does this mean I should make modifications to the model's layers so that it can be read by OpenCV? Is this a compatibility issue? Any feedback, workarounds or alternative approaches (e.g. TensorFlow C++ API solutions) are welcome.
Edit 1: Implementing a layer-type workaround
I reimplemented the depth_to_space layer manually in Python, using the following piece of code, based on these links: onnx-tensorflow, depth_to_space, keras-subpixel-conv.
x_shape = tf.shape(x)
n, h, w, c = x_shape[0], x_shape[1], x_shape[2], x_shape[3]
y = tf.reshape(x, (n, h, w, bs, bs, c // (bs ** 2)))
y = tf.transpose(y, (0, 1, 3, 2, 4, 5))
outputs = tf.reshape(y, (n, h * bs, w * bs, c // (bs ** 2)))
Now, when I run the same C++ code, I get the following error.
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (429) cv::dnn::dnn4_v20210608::ONNXImporter::populateNet DNN/ONNX: loading ONNX v4 model produced by 'tf2onnx':1.10.0. Number of nodes = 38, inputs = 14, outputs = 1
OpenCV(4.5.3) Error: Assertion failed (indexMat.total() == 1) in cv::dnn::dnn4_v20210608::ONNXImporter::handleNode, file ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 1842
[ERROR:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2127) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 2 inputs and 1 outputs: [Gather]:(model/tf.compat.v1.shape/Shape:0)
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2131) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Input[0] = 'Shape__72:0'
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2131) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Input[1] = 'Const__76'
[ INFO:0] global ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp (2135) cv::dnn::dnn4_v20210608::ONNXImporter::handleNode Output[0] = 'model/tf.compat.v1.shape/Shape:0'
OpenCV(4.5.3) Error: Unspecified error (> Node [Gather]:(model/tf.compat.v1.shape/Shape:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1842: error: (-215:Assertion failed) indexMat.total() == 1 in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
> ) in cv::dnn::dnn4_v20210608::ONNXImporter::handleNode, file ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 2146
OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:2146: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
> Node [Gather]:(model/tf.compat.v1.shape/Shape:0) parse error: OpenCV(4.5.3) ####\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1842: error: (-215:Assertion failed) indexMat.total() == 1 in function 'cv::dnn::dnn4_v20210608::ONNXImporter::handleNode'
So i just install SFML and was trying to do a simple programme, and the compilation works fine, but it's when I try to run the executable that it fails.
First I needed to do a trick to authorize the application to launch because it wasn't recognize by apple I follow those instruction to install SFML https://www.sfml-dev.org/tutorials/2.5/start-osx.php
After I managed to authorize the application when I run it I got this error message:
2020-11-24 10:20:55.638 exemple-graphisme1[2768:29657] *** Assertion failure in -[SFWindow setTitle:], NSWindow.m:2490
2020-11-24 10:20:55.640 exemple-graphisme1[2768:29657] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff204956af __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201cd3c9 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204be512 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff212776c9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 AppKit 0x00007fff22c7da75 -[NSWindow setTitle:] + 142
5 libsfml-window.2.5.dylib 0x000000010e5bf4fd _ZN2sf4priv15WindowImplCocoaC2ENS_9VideoModeERKNS_6StringEmRKNS_15ContextSettingsE + 269
6 libsfml-window.2.5.dylib 0x000000010e5b0e03 _ZN2sf4priv10WindowImpl6createENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE + 67
7 libsfml-window.2.5.dylib 0x000000010e5b02e5 _ZN2sf6Window6createENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE + 469
8 libsfml-graphics.2.5.dylib 0x000000010e61e823 _ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE + 99
9 exemple-graphisme1 0x000000010e582849 main + 233
10 libdyld.dylib 0x00007fff2033e631 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1] 2768 abort ./exemple-graphisme1
My code is very simple and only draw a point on the window
#include <SFML/Graphics.hpp>
using namespace sf;
using Point = Vector2f;
void draw_point(RenderWindow& w, Point pos, Color color) {
Vertex p[] = { Vertex(pos, color) };
w.draw(p, 1, sf::Points);
}
int main()
{
// ed: The line below originally contained "Hello World"
RenderWindow window(VideoMode(640, 480), "Ma super fenêtre");
window.clear(Color::White);
draw_point(window, {120, 5}, Color::Red);
window.display();
sleep(seconds(10));
return 0;
}
And I compiled my programme like this:
g++ -std=c++11 exemple-graphisme1.cpp -o exemple-graphisme1 -lsfml-system -lsfml-window -lsfml-graphics
Thanks for reading !
So the problem was very simple, I edited my code to translate it in english but in the beginning the first line was
RenderWindow window(VideoMode(640, 480), "Ma super fenêtre");
And the error occured because of the character 'ê'.
Thanks for your answer and sorry for this disappointing answer !
I have to work on a code written a few years ago which uses MPI and PETSc.
When I try to run it, I have an error with the function MPI_Comm_rank().
Here is the beginning of the code :
int main(int argc,char **argv)
{
double mesure_tps2,mesure_tps1;
struct timeval tv;
time_t curtime2,curtime1;
char help[] = "Solves linear system with KSP.\n\n"; // NB: Petsc est defini dans "fafemo_Constant_Globales.h"
std::cout<< "d�but PetscInitialize" <<std::endl;
(void*) PetscInitialize(&argc,&argv,(char *)0,help);
std::cout<< "d�but PetscInitialize fait" <<std::endl;
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
PetscFinalize();
}
Obviously, there are some code between MPI_Comm_rank() and PetscFinalize().
PetscInitialize and PetscFinalize call respectively MPI_INIT and MPI_FINALIZE.
In my makefil I have :
PETSC_DIR=/home/thib/Documents/bibliotheques/petsc-3.13.2
PETSC_ARCH=arch-linux-c-debug
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
PETSC36 = -I/home/thib/Documents/bibliotheques/petsc-3.13.2/include -I/home/thib/Documents/bibliotheques/petsc-3.13.2/arch-linux-c-debug/include
Mpi_include=-I/usr/lib/x86_64-linux-gnu/openmpi
#a variable with some files names
fafemo_files = fafemo_CI_CL-def.cc fafemo_Flux.cc fafemo_initialisation_probleme.cc fafemo_FEM_setup.cc fafemo_sorties.cc fafemo_richards_solve.cc element_read_split.cpp point_read_split.cpp read_split_mesh.cpp
PETSC_KSP_LIB_VSOIL=-L/home/thib/Documents/bibliotheques/petsc-3.13.2/ -lpetsc_real -lmpi -lmpi++
fafemo: ${fafemo_files} fafemo_Richards_Main.o
g++ ${CXXFLAGS} -g -o fafemo_CD ${fafemo_files} fafemo_Richards_Main.cc ${PETSC_KSP_LIB_VSOIL} $(PETSC36) ${Mpi_include}
Using g++ or mpic++ doesn't seem to change anything.
It compiles, but when I try to execute I have :
[thib-X540UP:03696] Signal: Segmentation fault (11)
[thib-X540UP:03696] Signal code: Address not mapped (1)
[thib-X540UP:03696] Failing at address: 0x44000098
[thib-X540UP:03696] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x3efd0)[0x7fbfa87e4fd0]
[thib-X540UP:03696] [ 1] /usr/lib/x86_64-linux-gnu/libmpi.so.20(MPI_Comm_rank+0x42)[0x7fbfa9533c42]
[thib-X540UP:03696] [ 2] ./fafemo_CD(+0x230c8)[0x561caa6920c8]
[thib-X540UP:03696] [ 3] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fbfa87c7b97]
[thib-X540UP:03696] [ 4] ./fafemo_CD(+0x346a)[0x561caa67246a]
[thib-X540UP:03696] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 0 on node thib-X540UP exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------
Also, I have others MPI programs on my computer and I never had such a problem.
Does anyone know why do I get this ?
If someone has the same issue :
When I installed PETSc, I ran ./configure with --download-mpich while I already had mpi installed on my computer.
To solve the problem I did "rm -rf ${PETSC_ARCH}" and ran ./configure again.
I have a simple c++ test program on a Ettus x310 that used to work now doesn't. I'm trying to simply set two center freq of two channels of a single USRP. The above Out of range error occurs when I try to set anything on the 2nd channel.
I get a crash with a Channel out of range error:
$ ./t2j.out
linux; GNU C++ version 4.8.4; Boost_105400; UHD_003.009.001-0-gf7a15853
-- X300 initialization sequence...
-- Determining maximum frame size... 1472 bytes.
-- Setup basic communication...
-- Loading values from EEPROM...
-- Setup RF frontend clocking...
-- Radio 1x clock:200
-- Initialize Radio0 control...
-- Performing register loopback test... pass
-- Initialize Radio1 control...
-- Performing register loopback test... pass
terminate called after throwing an instance of 'uhd::index_error'
what(): LookupError: IndexError: multi_usrp: RX channel 140445275195320 out of range for configured RX frontends
Aborted (core dumped)
Here is my test program:
int main( void )
{
// sources
gr::uhd::usrp_source::sptr usrp1;
const std::string usrp_addr = std::string( "addr=192.168.10.30" );
uhd::stream_args_t usrp_args = uhd::stream_args_t( "fc32" );
usrp_args.channels = std::vector<size_t> ( 0, 1 );
usrp1 = gr::uhd::usrp_source::make( usrp_addr, usrp_args );
usrp1->set_subdev_spec( std::string( "A:AB B:AB" ), 0 );
usrp1->set_clock_source( "external" );
usrp1->set_samp_rate( 5.0e6 );
usrp1->set_center_freq( 70e6, 0 ); // this is OK
usrp1->set_center_freq( 70e6, 1 ); // crashes here With RX Chan out of Range Error!
printf( "test Done!\n" );
return 0;
}
The only thing Ive found so far in searching is make sure PYTHONPATH is set correctly (and for the heck of it I made sure it pointed to the site_packages) but again that seems to be related to GRC and not C++.
I am using Ubuntu 14.04.4 and UHD 3.9.1 with gnuradio 3.7.8.1 (Ive also tried 3.7.9.2) with the same result.
The hardware is an Ettus x310 with two BasicRx daughterboards.
Someone from the gnuradio/uhd Mailing List helped me. It appears that the vector initialization was wrong:
Replace:
stream_args.channels = std::vector ( 0, 1 );
With these two lines:
stream_args.channels.push_back( 0 );
stream_args.channels.push_back( 1 );
There are other more concise methods but this does the trick for now.
-Bob
i am trying to get an angelscript test running, however, calling RegisterScriptArray() fails
System function (1, 39) : ERR : Expected '<end of file>'
(0, 0) : ERR : Failed in call to function 'RegisterObjectBehaviour' with 'array' and 'array<T># f(int&in type, int&in list) {repeat T}' (Code: -10)
the code is:
engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
// message callback
int r = engine->SetMessageCallback(asFUNCTION(as_messageCallback), 0, asCALL_CDECL); assert( r >= 0 );
RegisterStdString(engine);
RegisterScriptArray(engine, false);
r = engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(as_print), asCALL_CDECL); assert( r >= 0 );
What should i do? If i comment out the call it works, but thats obviously not what i want to archieve as i want arrays
After asking on their forums I got a reply (actually quite some time ago).
http://www.gamedev.net/topic/657233-registerscriptarray-fails
In case the link dies:
The main issue was a version mismatch between the plugins (which I compiled and installed manually) and the core (which I installed through my package manager). Now I include the plugins in my code and the core is manually compiled.
Hope it helps others encountering the same issue.