Search Results

Search found 41497 results on 1660 pages for 'fault'.

Page 2/1660 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • PHP Segmentation fault when started from crond

    - by Jeroen Moors
    Hello, I've a php script that's started each minute from cron. It almost always runs without any problem, except for about 10 times within 24h. The times it fails I get a segmentation fault like: bin/sh: line 1: 21815 Segmentation fault /usr/bin/myscript The number after "line 1:" is always different. I'm running: PHP 5.2.6-1+lenny8 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 14 2010 08:14:04) Is this a problem with my version of PHP? Is there a way to debug this? I have the feeling it crashes when the server load is high, but there's absolutely no prove for this. Any feedback is welcome!

    Read the article

  • Why does this give a segmentation fault?

    - by nightcracker
    I'm stunned, why does this code give me a segmentation fault? #include <stdio.h> #define LIMIT 1500000 typedef struct { int p; int a; int b; } triplet; int main(int argc, char **argv) { int i; triplet triplets[LIMIT]; for (i = 0; i < 5; i++) { triplets[i].p = 9; // remove this line and everything works fine } printf("%d\n", triplets[15].p); return 0; } EDIT: After changing LIMIT to 150 I no longer get a segmentation fault, it prints random numbers instead.

    Read the article

  • `php -v` segmentation fault

    - by John
    I'm getting an odd segmentation fault in PHP. Every few times, when I run: php -v I see: PHP 5.2.6 (cli) (built: Aug 19 2009 16:59:56) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies Segmentation fault (core dumped) Analyzing the core dump (backtrace with gdb): #0 0x00002ba6412f6c6c in ?? () #1 0x0000003f90c06367 in start_thread () from /lib64/libpthread.so.0 #2 0x0000003f904d2f7d in clone () from /lib64/libc.so.6 #3 0x0000000000000000 in ?? () Any ideas? OS: Linux version 2.6.18-92.el5 ([email protected]) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Jun 10 18:51:06 EDT 2008

    Read the article

  • vector segmentation fault

    - by user1849298
    I have a problem with the segmentation fault. Look: #include<fstream> using namespace std; int main(){ int n,i,vector[10001],vectorcopy[10001]; ifstream in("program.in"); ofstream out("program.out"); in>>n; for(i=1;i<=n;i++){ in>>vector[i]; vectorcopy[i]=vector[i]; } return 0;} And the debugger says: Program recived signal SIGSEGV, Segmentation fault Please, tell me what to do!

    Read the article

  • Segmentation fault before return

    - by donalmg
    Hi, Why does the following code seg fault before returning: int main() { char iD[20]; memset (iD, 0, 20); char* prefix; srand (time(NULL) ); int iPrefix = rand()%1000000; sprintf(prefix, "%i", iPrefix); int len = strlen(prefix); char* staticChar = "123456789"; //set prefix into ID memcpy(iD, prefix, len); // append static value memcpy(iD+len, staticChar, 20-len); cout << "END " << endl; return 0; } At the minute, the cout will display, but I get a segmentation fault.

    Read the article

  • Printf ubuntu Segmentation fault (core dumped)

    - by Someone
    I have this code: int a; printf("&a = %u\n",(unsigned)&a); printf("a\n"); printf("b\n"); printf("c\n"); printf("d\n"); I tried to print the pointer of a variable. But it fail on the row printf("a\n"); and says Segmentation fault (core dumped) Output: &a = 134525024 Segmentation fault (core dumped) When I remove the row printf("&a = %u\n",(unsigned)&a); from the code, its success. Output: a b c d What worng in my code?

    Read the article

  • Segmentation fault on writing char to char* address

    - by Lukas Dojcak
    hi guys, i've got problem with my little C program. Maybe you could help me. char* shiftujVzorku(char* text, char* pattern, int offset){ char* pom = text; int size = 0; int index = 0; while(*(text + size) != '\0'){ size++; } while(*(pom + index) != '\0'){ if(overVzorku(pom + index, pattern)){ while(*pattern != '\0'){ //vyment *pom s *pom + offset if(pom + index + offset < text + size){ char x = *(pom + index + offset); char y = *(pom + index); int adresa = *(pom + index + offset); *(pom + index + offset) = y; <<<<<< SEGMENTATION FAULT *(pom + index) = x; //*pom = *pom - *(pom + offset); //*(pom + offset) = *(pom + offset) + *pom; //*pom = *(pom + offset) - *pom; } else{ *pom = *pom - *(pom + offset - size); *(pom + offset - size) = *(pom + offset - size) + *pom; *pom = *(pom + offset - size) - *pom; } pattern++; } break; } index++; } return text; } Isn't important what's the programm doing. Mayby there's lot of bugs. But, why do I get SEGMENTATION FAULT (for destination see code) at this line? I'm, trying to write some char value to memory space, with help of address "pom + offset + index". Thanks for everything helpful. :)

    Read the article

  • Segmentation fault in Qt application framework

    - by yan bellavance
    this generates a segmentation fault becuase of "QColor colorMap[9]";. If I remove colorMap the segmentation fault goes away. If I put it back. It comes back. If I do a clean all then build all, it goes away. If I increase its arraysize it comes back. On the other hand if I reduce it it doesnt come back. I tired adding this array to another project and What could be happening. I am really curious to know. I have removed everything else in that class. This widget subclassed is used to promote a widget in a QMainWindow. class LevelIndicator : public QWidget { public: LevelIndicator(QWidget * parent); void paintEvent(QPaintEvent * event ); float percent; QColor colorMap[9]; int NUM_GRADS; }; the error happens inside ui_mainwindow.h at one of these lines: hpaFwdPwrLvl->setObjectName(QString::fromUtf8("hpaFwdPwrLvl")); verticalLayout->addWidget(hpaFwdPwrLvl); I know i am not providing much but I will give alink to the app. Im trying to see if anyone has a quick answer for this.

    Read the article

  • c++ malloc segment fault

    - by chnet
    I have a problem about malloc(). It is wired. My code is in the following. I use random generator to generate elements for an array. The array is opened by malloc(). If the array size is smaller than 8192, it is OK. If the size is larger than 8192, it shows segment fault. void random_generator(int num, int * array) { srand((unsigned)time(0)); int random_integer; for(int index=0; index< num; index++){ random_integer = (rand()%10000)+1; *(array+index) = random_integer; cout << index << endl; } } int main() { int array_size = 10000; int *input_array; input_array = (int*) malloc((array_size)); random_generator(8192, input_array); // if the number is larger than 8192, segment fault free(input_array); }

    Read the article

  • c++ malloc segmentation fault

    - by chnet
    I have a problem about malloc(). It is weird. My code is in the following. I use random generator to generate elements for an array. The array is opened by malloc(). If the array size is smaller than 8192, it is OK. If the size is larger than 8192, it shows segment fault. void random_generator(int num, int * array) { srand((unsigned)time(0)); int random_integer; for(int index=0; index< num; index++){ random_integer = (rand()%10000)+1; *(array+index) = random_integer; cout << index << endl; } } int main() { int array_size = 10000; int *input_array; input_array = (int*) malloc((array_size)); random_generator(8192, input_array); // if the number is larger than 8192, segment fault free(input_array); }

    Read the article

  • segmentation fault while using format string to scan input

    - by Aman Deep Gautam
    consider the code and its result: while ((row = mysql_fetch_row (table_info)) != NULL) { answer='\0'; printf ( "%s: ", row[0] ); scanf ( "%c", &answer ); getchar(); if ( answer == 'y') { printf ( "*****\n" ); table_name[index] = malloc ( strlen(row[0]) + 1 ); printf ( "*****\n" ); memcpy ( &table_name[index], &row[0], strlen(row[0]) + 1 ); } printf ( "finally inserted: %s \n", table_name[index]); } The result on execution: 1_time_access: y ***** ***** finally inserted: 1_time_access 2_time_access: y ***** ***** finally inserted: 2_time_access 39_time_access: y ***** ***** finally inserted: 39_time_access Explanation of result: row[0] has value 1_time_access, 2_time_access, 39_time_access. Now Consider a better way of doing it which is using a format string to escape the \n. I run the following code but it gives segentation fault, I cannot understand why. Code: while ((row = mysql_fetch_row (table_info)) != NULL) { answer='\0'; printf ( "%s: ", row[0] ); scanf ( "%[^\n]%*c", &answer ); if ( answer == 'y') { printf ( "*****\n" ); fflush(stdout); table_name[index] = malloc ( strlen(row[0]) + 1 ); printf ( "*****\n" ); fflush(stdout); memcpy ( &table_name[index], &row[0], strlen(row[0]) + 1 ); } printf ( "finally inserted: %s \n", table_name[index]); fflush(stdout); } Result: 1_time_access: y ***** ./set-env.sh: line 17: 15263 Segmentation fault (core dumped) ./exec dataset_one (do not worry about set-env.sh, it is the script running th program.) I canot understand why this is happening.

    Read the article

  • How to catch segmentation fault in Linux?

    - by Alex Farber
    I need to catch segmentation fault in third party library cleanup operations. This happens sometimes just before my program exits, and I cannot fix the real reason of this. In Windows programming I could do this with __try - __catch. Is there cross-platform or platform-specific way to do the same? I need this in Linux, gcc.

    Read the article

  • Seg Fault when using std::string on an embedded Linux platform

    - by Brad
    Hi, I have been working for a couple of days on a problem with my application running on an embedded Arm Linux platform. Unfortunately the platform precludes me from using any of the usual useful tools for finding the exact issue. When the same code is run on the PC running Linux, I get no such error. In the sample below, I can reliably reproduce the problem by uncommenting the string, list or vector lines. Leaving them commented results in the application running to completion. I expect that something is corrupting the heap, but I cannot see what? The program will run for a few seconds before giving a segmentation fault. The code is compiled using a arm-linux cross compiler: arm-linux-g++ -Wall -otest fault.cpp -ldl -lpthread arm-linux-strip test Any ideas greatly appreciated. #include <stdio.h> #include <vector> #include <list> #include <string> using namespace std; ///////////////////////////////////////////////////////////////////////////// class TestSeg { static pthread_mutex_t _logLock; public: TestSeg() { } ~TestSeg() { } static void* TestThread( void *arg ) { int i = 0; while ( i++ < 10000 ) { printf( "%d\n", i ); WriteBad( "Function" ); } pthread_exit( NULL ); } static void WriteBad( const char* sFunction ) { pthread_mutex_lock( &_logLock ); printf( "%s\n", sFunction ); //string sKiller; // <----------------------------------Bad //list<char> killer; // <----------------------------------Bad //vector<char> killer; // <----------------------------------Bad pthread_mutex_unlock( &_logLock ); return; } void RunTest() { int threads = 100; pthread_t _rx_thread[threads]; for ( int i = 0 ; i < threads ; i++ ) { pthread_create( &_rx_thread[i], NULL, TestThread, NULL ); } for ( int i = 0 ; i < threads ; i++ ) { pthread_join( _rx_thread[i], NULL ); } } }; pthread_mutex_t TestSeg::_logLock = PTHREAD_MUTEX_INITIALIZER; int main( int argc, char *argv[] ) { TestSeg seg; seg.RunTest(); pthread_exit( NULL ); }

    Read the article

  • gcc segmentation fault compiling 20k file

    - by aaa
    hi. I have fairly large file, 20k lines long (auto generated). It has been compiling okay, but after adding new if/endif preprocessor block, I started getting gcc internal errors: segmentation fault. the code inside new preprocessor block is not being compiled, so I am not sure where the error is coming from. my only guess is memory, but as far as I can tell it does not exhaust computer memory. Any thoughts?

    Read the article

  • segmentation fault for the simplest program??

    - by capex
    Hi, I am just starting out, but this piece of code is giving me a 'segmentation fault' and I can't find out what's wrong with it: #include<stdio.h> int main (void) { int number = 0; int lastDigit = 0; printf("Enter an integer: "); scanf("%d", number); number = number*10; printf("Number times ten is %d.\n", number); return 0; }

    Read the article

  • Fault Handling Slides and Q&A by Vennester

    - by JuergenKress
    Fault Handling It is one thing to architect, design, and code the “happy flow” of your automated business processes and services. It is another thing to deal with situations you do not want or expect to occur in your processes and services. This session dives into fault handling in Oracle Service Bus 11g and Oracle SOA Suite 11g, based on an order-to-cash business process. Faults can be divided into business faults, technical faults, programming errors, and faulty user input. Each type of fault needs a different approach to prevent them from occurring or to deal with them. For example, apply User Experience (UX) techniques to improve the quality of your application so that faulty user input can be prevented as much as possible. This session shows and demos what patterns and techniques can be used in Oracle Service Bus and Oracle SOA Suite to prevent and handle technical faults as well as business faults. Q&A This section lists answers to the questions that were raised during the preview event. Q: Where can retries be configured in Oracle Service Bus? The retry mechanism is used to prevent faults caused by temporary glitches such as short network interruptions. A faulted message is resend (retried) and might succeed this time since the glitch has passed. Retries are an out-of-the-box feature that can be used in Oracle Service Bus and Oracle SOA Suite using the Fault Policy framework. By default, retries are disabled in Oracle Service Bus. Read the full article. SOA & BPM Partner Community For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit  www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center. Blog Twitter LinkedIn Mix Forum Technorati Tags: fault handling,vennester,SOA Community,Oracle SOA,Oracle BPM,Community,OPN,Jürgen Kress

    Read the article

  • strange segmentation fault during function return

    - by Kyle
    I am running a program on 2 different machines. On one it works fine without issue. On the other it results in a segmentation fault. Through debugging, I have figured out where the fault occurs, but I can't figure out a logical reason for it to happen. In one function I have the following code: pass_particles(particle_grid, particle_properties, input_data, coll_eros_track, collision_number_part, world, grid_rank_lookup, grid_locations); cout<<"done passing particles"<<endl; The function pass_particles looks like: void pass_particles(map<int,map<int,Particle> > & particle_grid, std::vector<Particle_props> & particle_properties, User_input& input_data, data_tracking & coll_eros_track, vector<int> & collision_number_part, mpi::communicator & world, std::map<int,int> & grid_rank_lookup, map<int,std::vector<double> > & grid_locations) { //cout<<"east-west"<<endl; //east-west exchange (x direction) map<int, vector<Particle> > particles_to_be_sent_east; map<int, vector<Particle> > particles_to_be_sent_west; vector<Particle> particles_received_east; vector<Particle> particles_received_west; int counter_x_sent=0; int counter_x_received=0; for(grid_iter=particle_grid.begin();grid_iter!=particle_grid.end();grid_iter++) { map<int,Particle>::iterator part_iter; for (part_iter=grid_iter->second.begin();part_iter!=grid_iter->second.end();) { if (particle_properties[part_iter->second.global_part_num()].particle_in_box()[grid_iter->first]) { //decide if a particle has left the box...need to consider whether particle was already outside the box if ((part_iter->second.position().x()<(grid_locations[grid_iter->first][0]) && part_iter->second.position().x()>(grid_locations[grid_iter->first-input_data.z_numboxes()][0])) || (input_data.periodic_walls_x() && (grid_iter->first-floor(grid_iter->first/(input_data.xz_numboxes()))*input_data.xz_numboxes()<input_data.z_numboxes()) && (part_iter->second.position().x()>(grid_locations[input_data.total_boxes()-1][0])))) { particles_to_be_sent_west[grid_iter->first].push_back(part_iter->second); particle_properties[particle_grid[grid_iter->first][part_iter->first].global_part_num()].particle_in_box()[grid_iter->first]=false; counter_sent++; counter_x_sent++; } else if ((part_iter->second.position().x()>(grid_locations[grid_iter->first][1]) && part_iter->second.position().x()<(grid_locations[grid_iter->first+input_data.z_numboxes()][1])) || (input_data.periodic_walls_x() && (grid_iter->first-floor(grid_iter->first/(input_data.xz_numboxes()))*input_data.xz_numboxes())>input_data.xz_numboxes()-input_data.z_numboxes()-1) && (part_iter->second.position().x()<(grid_locations[0][1]))) { particles_to_be_sent_east[grid_iter->first].push_back(part_iter->second); particle_properties[particle_grid[grid_iter->first][part_iter->first].global_part_num()].particle_in_box()[grid_iter->first]=false; counter_sent++; counter_x_sent++; } //select particles in overlap areas to send to neighboring cells else if ((part_iter->second.position().x()>(grid_locations[grid_iter->first][0]) && part_iter->second.position().x()<(grid_locations[grid_iter->first][0]+input_data.diam_large()))) { particles_to_be_sent_west[grid_iter->first].push_back(part_iter->second); counter_sent++; counter_x_sent++; } else if ((part_iter->second.position().x()<(grid_locations[grid_iter->first][1]) && part_iter->second.position().x()>(grid_locations[grid_iter->first][1]-input_data.diam_large()))) { particles_to_be_sent_east[grid_iter->first].push_back(part_iter->second); counter_sent++; counter_x_sent++; } ++part_iter; } else if (particles_received_current[grid_iter->first].find(part_iter->first)!=particles_received_current[grid_iter->first].end()) { if ((part_iter->second.position().x()>(grid_locations[grid_iter->first][0]) && part_iter->second.position().x()<(grid_locations[grid_iter->first][0]+input_data.diam_large()))) { particles_to_be_sent_west[grid_iter->first].push_back(part_iter->second); counter_sent++; counter_x_sent++; } else if ((part_iter->second.position().x()<(grid_locations[grid_iter->first][1]) && part_iter->second.position().x()>(grid_locations[grid_iter->first][1]-input_data.diam_large()))) { particles_to_be_sent_east[grid_iter->first].push_back(part_iter->second); counter_sent++; counter_x_sent++; } part_iter++; } else { particle_grid[grid_iter->first].erase(part_iter++); counter_removed++; } } } world.barrier(); mpi::request reqs_x_send[particles_to_be_sent_west.size()+particles_to_be_sent_east.size()]; vector<multimap<int,int> > box_sent_x_info; box_sent_x_info.resize(world.size()); vector<multimap<int,int> > box_received_x_info; box_received_x_info.resize(world.size()); int counter_x_reqs=0; //send particles for(grid_iter_vec=particles_to_be_sent_west.begin();grid_iter_vec!=particles_to_be_sent_west.end();grid_iter_vec++) { if (grid_iter_vec->second.size()!=0) { //send a particle. 50 will be "west" tag if (input_data.periodic_walls_x() && (grid_iter_vec->first-floor(grid_iter_vec->first/(input_data.xz_numboxes()))*input_data.xz_numboxes()<input_data.z_numboxes())) { reqs_x_send[counter_x_reqs++]=world.isend(grid_rank_lookup[grid_iter_vec->first + input_data.z_numboxes()*(input_data.x_numboxes()-1)], grid_iter_vec->first + input_data.z_numboxes()*(input_data.x_numboxes()-1), particles_to_be_sent_west[grid_iter_vec->first]); box_sent_x_info[grid_rank_lookup[grid_iter_vec->first + input_data.z_numboxes()*(input_data.x_numboxes()-1)]].insert(pair<int,int>(world.rank(), grid_iter_vec->first + input_data.z_numboxes()*(input_data.x_numboxes()-1))); } else if (!(grid_iter_vec->first-floor(grid_iter_vec->first/(input_data.xz_numboxes()))*input_data.xz_numboxes()<input_data.z_numboxes())) { reqs_x_send[counter_x_reqs++]=world.isend(grid_rank_lookup[grid_iter_vec->first - input_data.z_numboxes()], grid_iter_vec->first - input_data.z_numboxes(), particles_to_be_sent_west[grid_iter_vec->first]); box_sent_x_info[grid_rank_lookup[grid_iter_vec->first - input_data.z_numboxes()]].insert(pair<int,int>(world.rank(),grid_iter_vec->first - input_data.z_numboxes())); } } } for(grid_iter_vec=particles_to_be_sent_east.begin();grid_iter_vec!=particles_to_be_sent_east.end();grid_iter_vec++) { if (grid_iter_vec->second.size()!=0) { //send a particle. 60 will be "east" tag if (input_data.periodic_walls_x() && (grid_iter_vec->first-floor(grid_iter_vec->first/(input_data.xz_numboxes())*input_data.xz_numboxes())>input_data.xz_numboxes()-input_data.z_numboxes()-1)) { reqs_x_send[counter_x_reqs++]=world.isend(grid_rank_lookup[grid_iter_vec->first - input_data.z_numboxes()*(input_data.x_numboxes()-1)], 2000000000-(grid_iter_vec->first - input_data.z_numboxes()*(input_data.x_numboxes()-1)), particles_to_be_sent_east[grid_iter_vec->first]); box_sent_x_info[grid_rank_lookup[grid_iter_vec->first - input_data.z_numboxes()*(input_data.x_numboxes()-1)]].insert(pair<int,int>(world.rank(),2000000000-(grid_iter_vec->first - input_data.z_numboxes()*(input_data.x_numboxes()-1)))); } else if (!(grid_iter_vec->first-floor(grid_iter_vec->first/(input_data.xz_numboxes())*input_data.xz_numboxes())>input_data.xz_numboxes()-input_data.z_numboxes()-1)) { reqs_x_send[counter_x_reqs++]=world.isend(grid_rank_lookup[grid_iter_vec->first + input_data.z_numboxes()], 2000000000-(grid_iter_vec->first + input_data.z_numboxes()), particles_to_be_sent_east[grid_iter_vec->first]); box_sent_x_info[grid_rank_lookup[grid_iter_vec->first + input_data.z_numboxes()]].insert(pair<int,int>(world.rank(), 2000000000-(grid_iter_vec->first + input_data.z_numboxes()))); } } } counter=0; for (int i=0;i<world.size();i++) { //if (world.rank()!=i) //{ reqs[counter++]=world.isend(i,1000000000,box_sent_x_info[i]); reqs[counter++]=world.irecv(i,1000000000,box_received_x_info[i]); //} } mpi::wait_all(reqs, reqs + world.size()*2); //receive particles //receive west particles for (int j=0;j<world.size();j++) { multimap<int,int>::iterator received_info_iter; for (received_info_iter=box_received_x_info[j].begin();received_info_iter!=box_received_x_info[j].end();received_info_iter++) { //receive the message if (received_info_iter->second<1000000000) { //receive the message world.recv(received_info_iter->first,received_info_iter->second,particles_received_west); //loop through all the received particles and add them to the particle_grid for this processor for (unsigned int i=0;i<particles_received_west.size();i++) { particle_grid[received_info_iter->second].insert(pair<int,Particle>(particles_received_west[i].global_part_num(),particles_received_west[i])); if(particles_received_west[i].position().x()>grid_locations[received_info_iter->second][0] && particles_received_west[i].position().x()<grid_locations[received_info_iter->second][1]) { particle_properties[particles_received_west[i].global_part_num()].particle_in_box()[received_info_iter->second]=true; } counter_received++; counter_x_received++; } } else { //receive the message world.recv(received_info_iter->first,received_info_iter->second,particles_received_east); //loop through all the received particles and add them to the particle_grid for this processor for (unsigned int i=0;i<particles_received_east.size();i++) { particle_grid[2000000000-received_info_iter->second].insert(pair<int,Particle>(particles_received_east[i].global_part_num(),particles_received_east[i])); if(particles_received_east[i].position().x()>grid_locations[2000000000-received_info_iter->second][0] && particles_received_east[i].position().x()<grid_locations[2000000000-received_info_iter->second][1]) { particle_properties[particles_received_east[i].global_part_num()].particle_in_box()[2000000000-received_info_iter->second]=true; } counter_received++; counter_x_received++; } } } } mpi::wait_all(reqs_y_send, reqs_y_send + particles_to_be_sent_bottom.size()+particles_to_be_sent_top.size()); mpi::wait_all(reqs_z_send, reqs_z_send + particles_to_be_sent_south.size()+particles_to_be_sent_north.size()); mpi::wait_all(reqs_x_send, reqs_x_send + particles_to_be_sent_west.size()+particles_to_be_sent_east.size()); cout<<"x sent "<<counter_x_sent<<" and received "<<counter_x_received<<" from rank "<<world.rank()<<endl; cout<<"rank "<<world.rank()<<" sent "<<counter_sent<<" and received "<<counter_received<<" and removed "<<counter_removed<<endl; cout<<"done passing"<<endl; } I only posted some of the code (so ignore the fact that some variables may appear to be undefined, as they are in a portion of the code I didn't post) When I run the code (on the machine in which it fails), I get done passing but not done passing particles I am lost as to what could possibly cause a segmentation fault between the end of the called function and the next line in the calling function and why it would happen on one machine and not another.

    Read the article

  • Segmentation fault in Qt Designer 4.6 with custom widget

    - by chedi
    Hi, I had a segmentation fault when using my new Qt Widget with Qt Designer 4.6. The problem arise when trying to preview the new widget. when using gdb I found that the problem is in qdesigner_internal::WidgetFactory::applyStyleToTopLevel: Program received signal SIGSEGV, Segmentation fault. qdesigner_internal::WidgetFactory::applyStyleToTopLevel (style=0x0, widget=0x1829df0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp:777 777 /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp: No such file or directory. in /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp (gdb) bt #0 qdesigner_internal::WidgetFactory::applyStyleToTopLevel (style=0x0, widget=0x1829df0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/widgetfactory.cpp:777 #1 0x00007ffff7475bed in qdesigner_internal::QDesignerFormBuilder::createPreview (fw=, styleName=..., appStyleSheet=..., deviceProfile=, scriptErrors= 0x7fffffffbee0, errorMessage=0x7fffffffc3f0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp:404 #2 0x00007ffff7476773 in qdesigner_internal::QDesignerFormBuilder::createPreview (fw=0x0, styleName=..., appStyleSheet=..., deviceProfile=..., errorMessage=0x0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp:439 #3 0x00007ffff7532b27 in qdesigner_internal::PreviewManager::createPreview (this=0x837f20, fw=0x1879200, pc=..., deviceProfileIndex=-1, errorMessage=0x7fffffffc3f0, initialZoom=-1) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/previewmanager.cpp:686 #4 0x00007ffff75343cf in qdesigner_internal::PreviewManager::showPreview (this=0x837f20, fw=0x1879200, pc=..., deviceProfileIndex=-1, errorMessage=0x7fffffffc3f0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/previewmanager.cpp:760 #5 0x00007ffff753472f in qdesigner_internal::PreviewManager::showPreview (this=0x837f20, fw=0x1879200, style=..., deviceProfileIndex=-1, errorMessage=0x7fffffffc3f0) at /var/tmp/qt-x11-src-4.6.0/tools/designer/src/lib/shared/previewmanager.cpp:659 because a null pointer was passed there: void WidgetFactory::applyStyleToTopLevel(QStyle *style, QWidget *widget) { const QPalette standardPalette = style-standardPalette(); if (widget-style() == style && widget-palette() == standardPalette) return; //.... } I'm new in Qt and this is my first custom widget. does anybody have a clue for solving this. here is my widget code MBICInput::MBICInput(QWidget *parent) : QStackedWidget(parent){ displayPage = new QWidget(); displayPage-setObjectName(QString::fromUtf8("displayPage")); inputLB = new QLabel(displayPage); inputLB-setObjectName(QString::fromUtf8("inputLabel")); inputLB-setCursor(QCursor(Qt::PointingHandCursor)); addWidget(displayPage); EditPage = new QWidget(); EditPage-setProperty("EditInputLine", QVariant(true)); EditPage-setObjectName(QString::fromUtf8("EditPage")); inputInput = new QLineEdit(EditPage); inputInput-setGeometry(QRect(5, 10, 231, 25)); inputInput-setObjectName(QString::fromUtf8("input")); addWidget(EditPage); _animation = new QString(""); _message = new QString("Message"); _validator = new QRegExpValidator(QRegExp("[a-zA-Z]+"), this); } MBICInput::~MBICInput() { } QValidator::State MBICInput::validate(QString &text, int &pos) const{ return _validator-validate(text, pos); } void MBICInput::paintEvent(QPaintEvent *) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); } QSize MBICInput::minimumSizeHint() const{ return QSize(200, 40); } QSize MBICInput::sizeHint() const{ return QSize(200, 40); } void MBICInput::setAnimation(const QString &animation){ *_animation = animation; update(); } QString MBICInput::animation() const{ return *_animation; } void MBICInput::setMessage(const QString &message){ *_message = message; update(); } QString MBICInput::message() const{ return *_message; } void MBICInput::mousePressEvent(QMouseEvent *event){ if(currentIndex()==0){ setCurrentIndex(1); }else{ setCurrentIndex(0); } update(); }

    Read the article

  • seg fault caused by malloc and sscanf in a function

    - by Framester
    Hi, I want to open a text file (see below), read the first int in every line and store it in an array, but I get an segmentation fault. I got rid of all gcc warnings, I read through several tutorials I found on the net and searched stackoverflow for solutions, but I could't make out, what I am doing wrong. It works when I have everything in the main function (see example 1), but not when I transfer it to second function (see example 2 further down). In example 2 I get, when I interpret gdb correctly a seg fault at sscanf (line,"%i",classes[i]);. I'm afraid, it could be something trivial, but I already wasted one day on it. Thanks in advance. [Example 1] Even though that works with everything in main: #include<stdio.h> #include<stdlib.h> #include<string.h> const int LENGTH = 1024; int main() { char *filename="somedatafile.txt"; int *classes; int lines; FILE *pfile = NULL; char line[LENGTH]; pfile=fopen(filename,"r"); int numlines=0; char *p; while(fgets(line,LENGTH,pfile)){ numlines++; } rewind(pfile); classes=(int *)malloc(numlines*sizeof(int)); if(classes == NULL){ printf("\nMemory error."); exit(1); } int i=0; while(fgets(line,LENGTH,pfile)){ printf("\n"); p = strtok (line," "); p = strtok (NULL, ", "); sscanf (line,"%i",&classes[i]); i++; } fclose(pfile); return 1; } [Example 2] This does not with the functionality transfered to a function: #include<stdio.h> #include<stdlib.h> #include<string.h> const int LENGTH = 1024; void read_data(int **classes,int *lines, char *filename){ FILE *pfile = NULL; char line[LENGTH]; pfile=fopen(filename,"r"); int numlines=0; char *p; while(fgets(line,LENGTH,pfile)){ numlines++; } rewind(pfile); * classes=(int *)malloc(numlines*sizeof(int)); if(*classes == NULL){ printf("\nMemory error."); exit(1); } int i=0; while(fgets(line,LENGTH,pfile)){ printf("\n"); p = strtok (line," "); p = strtok (NULL, ", "); sscanf (line,"%i",classes[i]); i++; } fclose(pfile); *lines=numlines; } int main() { char *filename="somedatafile.txt"; int *classes; int lines; read_data(&classes, &lines,filename) ; for(int i=0;i<lines;i++){ printf("\nclasses[i]=%i",classes[i]); } return 1; } [Content of somedatafile.txt] 50 21 77 0 28 0 27 48 22 2 55 0 92 0 0 26 36 92 56 4 53 0 82 0 52 -5 29 30 2 1 37 0 76 0 28 18 40 48 8 1 37 0 79 0 34 -26 43 46 2 1 85 0 88 -4 6 1 3 83 80 5 56 0 81 0 -4 11 25 86 62 4 55 -1 95 -3 54 -4 40 41 2 1 53 8 77 0 28 0 23 48 24 4 37 0 101 -7 28 0 64 73 8 1 ...

    Read the article

  • Getting Segmentation Fault in C++, but why?

    - by Carlos
    I am getting segmentation fault in this code but i cant figure out why. I know a segmentation fault happens when a pointer is NULL, or when it points to a random memory address. #include <iostream> #include <fstream> #include <cmath> using namespace std; //**************************** CLASS ******************************* class Database { struct data{ string city; float latitude, longitude; data *link; }*p; public: Database(); void display(); void add(string cityName, float lat, float lon); private: string cityName; float lat, lon; }; //************************** CLASS METHODS ************************** Database::Database() { p = NULL; } void Database::add(string cityName, float lat, float lon){ data *q, *t; if(p == NULL){ p = new data; p -> city = cityName; p -> latitude = lat; p -> longitude = lon; p -> link = NULL; } else{ q = p; while(q -> link != NULL){ q = q -> link; } t = new data; t -> city = cityName; t -> latitude = lat; t -> longitude = lon; q -> link = t; } } void Database::display() { data *q; cout<<endl; for( q = p ; q != NULL ; q = q->link ) cout << endl << q -> city; } //***************************** MAIN ******************************* //*** INITIALIZATION *** Database D; void loadDatabase(); //****** VARIABLES ***** //******* PROGRAM ****** int main() { loadDatabase(); D.display(); } void loadDatabase() { int i = 0; string cityName; float lat, lon; fstream city; city.open("city.txt", ios::in); fstream latitude; latitude.open("lat.txt", ios::in); fstream longitude; longitude.open("lon.txt", ios::in); while(!city.eof()){ //************************************ city >> cityName; //* * latitude >> lat; //Here is where i think is the problem longitude >> lon; //* * D.add(cityName, lat, lon); //************************************ } city.close(); latitude.close(); longitude.close(); } This is the error am actually getting in console

    Read the article

  • segmentation fault using scanf

    - by agarrow
    noob question here: I'm trying to write a simple menu interface, but I keep getting a segmentation fault error and I can't figure out why. #include <stdlib.h> #include <stdio.h> int flush(); int add(char *name, char *password, char *type); int delete(char *name); int edit(char *name, char *password, char *type, char *newName, char *newPassword, char *newType); int verify(char *name, char *password); int menu(){ int input; char *name, *password, *type, *newName, *newPassword, *newType; printf("MAIN MENU \n ============\n"); printf("1. ADD\n"); printf("2. DELETE\n"); printf("3. EDIT\n"); printf("4. VERIFY\n"); printf("5. Exit\n"); printf("Selection:"); scanf("%d", &input); flush(); switch (input){ case 1: printf("%s\n", "Enter Name:"); scanf("%s", name); flush(); printf("%s\n", "enter password" ); scanf("%s", password); flush(); printf("%s\n","enter type" ); scanf("%s",type); add(name, password, type); menu(); break; case 2: printf("Enter Name:" ); scanf("%s",name); flush(); delete(name); menu(); break; case 3: printf("Enter Name:\n"); scanf("%s",name); flush(); printf("Enter Password\n"); scanf("%s", password); flush(); printf("enter type:\n"); scanf("%s", type); flush(); printf("enter your new username:\n"); scanf("%s",newName); flush(); printf("enter your new password\n"); scanf("%s", newPassword); flush(); printf("enter your new type\n"); scanf("%s",newType); flush(); edit(name, password, type, newName, newPassword, newType); menu(); break; case 4: printf("Enter Name\n"); scanf("%s",name); flush(); printf("Enter Password\n"); scanf("%s",password); flush(); verify(name, password); menu(); break; case 5: return 0; default: printf("invalid input, please select from the following:\n"); menu(); } return 0; } int flush(){ int ch; while ((ch = getchar()) != EOF && ch != '\n') ; return 0; } I get the segmentation fault after entering two fields, in any menu option

    Read the article

  • Android XMLRPC Fault Code

    - by sameersegal
    Hey, We have been using XMLRPC for android and it was working well until we got our hands dirty with Base64 encoding for byte[] (images) -- (we did base64_string.replace("/","$$") for transmission). We have tried undoing the changes and its looking an XMLRPC error. We are getting the following error in the DDMS: 06-10 23:27:02.970: DEBUG/Test(343): org.xmlrpc.android.XMLRPCFault: XMLRPC Fault: [code 0] 06-10 23:27:02.970: DEBUG/Test(343): at org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:308) 06-10 23:27:02.970: DEBUG/Test(343): at org.xmlrpc.android.XMLRPCMethod.run(XMLRPCMethod.java:33) Just before this I checked the body (xml message -- which is perfect) and the response received: 06-10 23:27:02.940: INFO/System.out(343): Response received: org.apache.http.message.BasicHttpResponse@437762f8 Since it the message is not even reaching our cloud, the issue is with XMLRPC for android. Any help will be most appreciated. Thanks Best Sameer

    Read the article

  • Robust fault tolerant MySQL replication

    - by Joshua
    Is there any way to get a fault tolerant MySQL replication? I am in an environment that has many networking issues. It appears that replication gets an error and just stops. I need it to continue to work and recover from these faults. There is some wrapper software that checks the state of replication and restarts it in the case of losing its log position. Is there an alternative? Note: Replication is done from an embedded computer with MySQL 4.1 to a external computer that has MySQL 5.0.45

    Read the article

  • graphviz segmentation fault

    - by LucaB
    Hi I'm building a graph with many nodes, around 3000. I wrote a simple python program to do the trick with graphviz, but it gives me segmentation fault and I don't know why, if the graph is too big or if i'm missing something. The code is: #!/usr/bin/env python # Import graphviz import sys sys.path.append('..') sys.path.append('/usr/lib/graphviz') import gv # Import pygraph from pygraph.classes.graph import graph from pygraph.classes.digraph import digraph from pygraph.algorithms.searching import breadth_first_search from pygraph.readwrite.dot import write # Graph creation gr = graph() file = open('nodes.dat', 'r') line = file.readline() while line: gr.add_nodes([line[0:-1]]) line = file.readline() file.close() print 'nodes finished, beginning edges' edges = open('edges_ok.dat', 'r') edge = edges.readline() while edge: gr.add_edge((edge.split()[0], edge.split()[1])) edge = edges.readline() edges.close() print 'edges finished' print 'Drawing' # Draw as PNG dot = write(gr) gvv = gv.readstring(dot) gv.layout(gvv,'dot') gv.render(gvv,'svg','graph.svg') and it crashes at the gv.layout() call. The files are somthing like: nodes: node1 node2 node3 edges_ok: node1 node2 node2 node3

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >