Search Results

Search found 41598 results on 1664 pages for 'segmentation fault'.

Page 10/1664 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • RAID 5 - DELL 2850 and others

    - by Kiara
    I have installed Ubuntu on a DELL 2850 and I have configured an array of 5 disks (SCSI 73GB 10K) in RAID5. I wanted to simulate a drive error so in the middle of something I just took one of the drives out and put it back again after a bit. Then the drive shows an orange light and seems to be rebuilding but actually is taking hours and hours with no results. So I went to the PERC utility (Ctrl+M) and the disk shows "REBLD". But it never gets to an online state. So I went to Objects - Physical drives - Rebuilding - View rebuild process. And in here I can see a bar moving from 0%... but if I reboot before finishing and get into the PERC Utility again, it seems to start again rebuilding from 0% - so it is not rebuilding automatically. My concern is: what would happen in a real situation? Do I have to just switch the server off and go to the Perc utility to start the rebuilding manually? I thought the whole point was to have this done automatically and without the need of stopping the server. Or does it perhaps rebuild automatically indeed but needs to have enough time without rebooting because otherwise the rebuilding process will start from scratch? It seems to take more than 3h for a 73gb disk! My second question is: can I mix then hard drives? So if I have a RAID of 5x73GB 10K can I use different size (146GB) or speeds (15K)? Apparently someone said it is OK in here Poweredge 2850: replace disk with larger in RAID?

    Read the article

  • What's the best way to know if your web server goes down?

    - by Mike Christensen
    I noticed my website only got 8 visitors today, which means it probably went down very early this morning and I never noticed. Why it went down is another story. Ideally, I'd like to be emailed if my web server becomes unresponsive or does not return an HTTP 200. Is there either a cloud-based service (either free or pretty cheap) that can monitor your website? If not, is there a good free/open source program I can run on either a Linux or Windows machine that will monitor a website and email me if it goes down? Thanks!

    Read the article

  • ClearOS - how to avoid getting stuck at a fsck message at boot?

    - by Scott Szretter
    I have had this happen a couple times - I have a ClearOS Enterprise 5.2 box, and due to a power outage or similar, it ends up showing an error at boot and saying that fsck needs to be run (I think it said with (or without?) the -a parameter). The problem is, I need this box to be headless, at a remote location (miles away)! SO, I need to come up with a solution on how to either have it automatically repair itself, without someone to be present with a monitor and keyboard. Another possibility is to simply avoid the issue all together - maybe there is something that can be changed so it's very unlikely to happen (I am unable to avoid the power outage of course - at least not practically). Finally, maybe it can be boot off a read only media (cd) or file system or similar? At least the base OS, so that it would always at least boot with enough configuration that might allow remote access, or basic connectivity?

    Read the article

  • Heroku SSL: Pem is invalid / Key doesn't match the Pem certificate

    - by Jane
    I bought a Gandi.net SSL certificate and I'm following this tutorial. I created the key file. then transformed it to CSR then added it to Gandi website and waited for the CRT. then removed the password from the key === result : [FINAL KEY] then merged the CRT and the FINAL KEY into one file == result : [FINAL PEM] then heroku ssl:add final_pem final_key --app app_name and... got Pem is invalid / Key doesn't match the Pem certificate. I tried 3 times and I really don't know what's going one. Can you help ?

    Read the article

  • SQL Server 2008 R2 100% availability

    - by Mark Henderson
    Is there any way to provide 100% uptime on SQL Server 2008 R2? From my experience, the downtimes for the different replication methods are: Log Shipping: Lots (for DR only) Mirroring w. NLB: ~ 45 seconds Clustering: ~ 5-15 seconds And all of these solutions involve all of the connections being dropped from the source, so if the downtime is too long or the app's gateway doesn't support reconnection in the middle of task, then you're out of luck. The only way I can think to get around this is to abstract the clustering a level (by virtualising and then enabling VMWare FT. Yuck. Good luck getting this to work on a quad-socket, 32-core system anyway.). Is there any other way of providing 100% uptime of SQL Server?

    Read the article

  • pfsense CARP - wan failure on firewall

    - by eldblz
    I have recently configured 2 firewall (on 2 DELL PowerEdge R210II with ESXI 5.1) with pfsense. We have several LANs and 2 WANs. Everything is running fine but i have a strange behavior: i can access internet from alla LANs but not from the firewall (itself). For example the firewall cannot retrive package information or if i setup a gatway monitor ip (like google 8.8.8.8 ) this fails. These are the screenshots of firewall configuration: http://imgur.com/a/LNuMz#0 ATM i kept firewall rules to minimum to avoid problem or conflicts. Any ideas how to solve the problem? Thank you in advance.

    Read the article

  • keepalived questions (requirements, abilities, limitations)

    - by Poni
    1) What are keepalived's (physical/network) requirements? Does the two (or more) keepalived' nodes need to be connected to the same switch? (something related to broadcasting maybe). 2) Can keepalived nodes run on different networks, "internet" networks? 3) Is keepalived depend on the router? (as far as I understand, the virtual IP should point to the real router/switch that connects both nodes). 4) Is keepalived "service-independent"? - What is keepalived's involvement domain? IPs only? Or is it service/protocol oriented? - Does it deal ONLY with IP, or is it designed for HTTP for example? - In other words, can I use it for custom (network-based) app? 5) Have more than one failover server? If the answer for question #4 is "yes", i.e it depends on the service type, then is there any general alternative? Preferably easy to install/configure :)

    Read the article

  • Stress test a server for simultaneous connection

    - by weston smith
    I am trying to figure out a practical way to stress test a server for 300 to 600 simultaneous connections. Any advice? Thank you everyone for the help. To be more specific (sorry I wasn't before) this is a Flash Media Server on AWS that will be streaming live video. I've been having problems with the video freezing/buffering for everyone and I need to verify if its on the user end, upload end, or server end. I mainly need help with stress testing the server with 300-600 multiple request before going live.

    Read the article

  • High availability for databases (DRBD + GFS)?

    - by EvanAlm
    Does it work to have like an MySQL (or any other relational database) on the GFS (with DRBD) and have multiple nodes reading and writing to it? Is that the "best" way of providing a HA database/application setup if so? Is RHEL (cluster suite) a good way to set up this? (or centos)

    Read the article

  • What happens if an OpenStack cloud controller dies?

    - by magu
    I've been reading up on OpenStack and how we can re-create an EC2/S3-style cloud for our internal development and I'm having a hard time finding information on how the OpenStack cloud controller provides redundancy of the cloud management services. I know I can setup multiple Swift and Nova nodes, but not a single document/article/howto/wiki contains information on: a) what happens if the cloud controller node dies; and b) how to setup redundant cloud controllers. It seems to me that, although it is massively scalable, there is a big single-point-of-failure built into OpenStack. Can anyone with more experience on OpenStack please shed some light as to how it all works in regards to high-availability?

    Read the article

  • Failure Scenarios in IP networks [closed]

    - by Karthik
    I am searching for a list of faults that may occur in a traditional IP network. To give you a better understanding of what I am looking for: For an MPLS-IP network the set of faults may be something as given in this cisco site. I want pointers to such kind of faults for a traditional IP network. Individual suggestions from you are welcome, but in doing so, please also provide a link to the official site from which you came with those failure scenarios.

    Read the article

  • What TLDs should I use for my NS records for redundancy? (DNSSEC support required)

    - by makerofthings7
    Question As a general practice, is it a good idea to use multiple TLDs for the name servers? How should I choose between which TLD would be a good candidate for being the root server for my NS name? More Info I am switching over 800 DNS zones to an outsourced DNS provider. I originally planned on setting the zone names to nsX.company.com, but think it would be best to have multiple TLDs such as .net , .org and .info Since I plan on supporting DNSSec at company.com I think all the 1st tier Name servers must support it as well. Part of the inspiration for this question came from our provider UltraDNS. In their configuration screen for our domains, they actively verify and alert us if our name servers aren't exactly: pdns1.ultradns.net pdns2.ultradns.net pdns3.ultradns.org pdns4.ultradns.org pdns5.ultradna.info pdns6.ultradns.co.uk

    Read the article

  • Segmentation fault on MPI, runs properly on OpenMP

    - by Bellman
    Hi, I am trying to run a program on a computer cluster. The structure of the program is the following: PROGRAM something ... CALL subroutine1(...) ... END PROGRAM SUBROUTINE subroutine1(...) ... DO i=1,n CALL subroutine2(...) ENDDO ... END SUBROUTINE SUBROUTINE subroutine2(...) ... CALL subroutine3(...) CALL subroutine4(...) ... END SUBROUTINE The idea is to parallelize the loop that calls subroutine2. Main program basically only makes the call to subroutine1 and only its arguments are declared. I use two alternatives. On the one hand, I write OpenMP clauses arround the loop. On the other hand, I add an IF conditional branch arround the call and I use MPI to share the results. In the OpenMP case, I add CALL KMP_SET_STACKSIZE(402653184) at the beginning of the main program and I can run it with 8 threads on an 8 core machine. When I run it (on the same 8 core machine) with MPI (either using 8 or 1 processors) it crashes just when makes the call to subroutine3 with a segmentation fault (signal 11) error. If I comment subroutine4, then it doesn't crash (notice that it crashed just when calling subroutine3 and it works when commenting subroutine4). I compile with mpif90 using MPICH2 libraries and the following flags: -O3 -fpscomp logicals -openmp -threads -m64 -xS. The machine has EM64T architecture and I use a Debian Linux distribution. I set ulimit -s hard before running the program. Any ideas on what is going on? Has it something to do with stack size? Thanks in advance

    Read the article

  • Binder and variadic template ends up in a segmentation fault

    - by phlipsy
    I wrote the following program #include <iostream> template<typename C, typename Res, typename... Args> class bind_class_t { private: Res (C::*f)(Args...); C *c; public: bind_class_t(Res (C::*f)(Args...), C* c) : f(f), c(c) { } Res operator() (Args... args) { return (c->*f)(args...); } }; template<typename C, typename Res, typename... Args> bind_class_t<C, Res, Args...> bind_class(Res (C::*f)(Args...), C* c) { return bind_class<C, Res, Args...>(f, c); } class test { public: int add(int x, int y) { return x + y; } }; int main() { test t; // bind_class_t<test, int, int, int> b(&test::add, &t); bind_class_t<test, int, int, int> b = bind_class(&test::add, &t); std::cout << b(1, 2) << std::endl; return 0; } compiled it with gcc 4.3.3 and got a segmentation fault. After spending some time with gdb and this program it seems to me that the addresses of the function and the class are mixed up and a call of the data address of the class isn't allowed. Moreover if I use the commented line instead everything works fine. Can anyone else reproduce this behavior and/or explain me what's going wrong here?

    Read the article

  • segmentation fault in file operations in c

    - by mekasperasky
    #include<stdio.h> /* this is a lexer which recognizes constants , variables ,symbols, identifiers , functions , comments and also header files . It stores the lexemes in 3 different files . One file contains all the headers and the comments . Another file will contain all the variables , another will contain all the symbols. */ int main() { int i; char a,b[20],c; FILE *fp1; fp1=fopen("source.txt","r"); //the source file is opened in read only mode which will passed through the lexer //now lets remove all the white spaces and store the rest of the words in a file if(fp1==NULL) { perror("failed to open source.txt"); //return EXIT_FAILURE; } i=0; while(1) { a=fgetc(fp1); if(a !="") { b[i]=a; } else { fprintf(fp1, "%.20s\n", b); i=0; continue; } i=i+1; /*Switch(a) { case EOF :return eof; case '+':sym=sym+1; case '-':sym=sym+1; case '*':sym=sym+1; case '/':sym=sym+1; case '%':sym=sym+1; case ' */ } return 0; } how does this code end up in segmentation fault?

    Read the article

  • Segmentation Fault

    - by Biranchi
    Hi All, I have the following piece of code for getting the hostname and IP address, #include <stdlib.h> #include <stdio.h> #include <netdb.h> /* This is the header file needed for gethostbyname() */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int main(int argc, char *argv[]) { struct hostent *he; if (argc!=2){ printf("Usage: %s <hostname>\n",argv[0]); exit(-1); } if ((he=gethostbyname(argv[1]))==NULL){ printf("gethostbyname() error\n"); exit(-1); } printf("Hostname : %s\n",he->h_name); /* prints the hostname */ printf("IP Address: %s\n",inet_ntoa(*((struct in_addr *)he->h_addr))); /* prints IP address */ } but i am getting a warning and segmentation fault as host.c: In function ‘main’: host.c:24: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’ What is the error in the code ?? Thanks

    Read the article

  • C++: Weird Segmentation fault.

    - by Kleas
    I am trying to print something using C++. However, I am running into a strange bug that has left me clueless, I use the following code: PRINTDLG pd; ZeroMemory(&pd, sizeof(pd)); pd.lStructSize = sizeof(pd); pd.Flags = PD_RETURNDEFAULT; PrintDlg(&pd); // Set landscape DEVMODE* pDevMode = (DEVMODE*)GlobalLock(pd.hDevMode); pDevMode->dmOrientation = DMORIENT_LANDSCAPE; pd.hwndOwner = mainWindow; pd.Flags = PD_RETURNDC | PD_NOSELECTION; GlobalUnlock(pd.hDevMode); if (PrintDlg(&pd)) { DOCINFO di; di.cbSize = sizeof(DOCINFO); di.lpszDocName = "Test Print"; di.lpszOutput = (LPTSTR)NULL; di.fwType = 0; //start printing StartDoc(pd.hDC, &di); int a; int b; int c; int d; int e; int f; // int g; // Uncomment this -> CRASH EndDoc(pd.hDC); DeleteDC(pd.hDC); } else { cout << "Did not print: " << CommDlgExtendedError() << endl; } The moment I uncomment 'int g;' I get a: "Program received signal SIGSEGV, Segmentation fault." I use codeblocks and the mingw compiler, both up to date. What could be causing this?

    Read the article

  • Segmentation fault on instationation of more than 1 object

    - by ECE
    I have a class called "Vertex.hpp" which is as follows: #include <iostream> #include "Edge.hpp" #include <vector> using namespace std; /** A class, instances of which are nodes in an HCTree. */ class Vertex { public: Vertex(char * str){ *name=*str; } vector<Vertex*> adjecency_list; vector<Edge*> edge_weights; char *name; }; #endif When I instantiate an object of type Vector as follows: Vertex *first_read; Vertex *second_read; in.getline(input,256); str=strtok(input," "); first_read->name=str; str=strtok(NULL, " "); second_read->name=str; A segmentation fault occurs when more than 1 object of type Vector is instantiated. Why would this occur if more than 1 object is instantiated, and how can i allow multiple objects to be instantiated?

    Read the article

  • Declaring two large 2d arrays gives segmentation fault.

    - by pfdevil
    Hello, i'm trying to declare and allocate memory for two 2d-arrays. However when trying to assign values to itemFeatureQ[39][16816] I get a segmentation vault. I can't understand it since I have 2GB of RAM and only using 19MB on the heap. Here is the code; double** reserveMemory(int rows, int columns) { double **array; int i; array = (double**) malloc(rows * sizeof(double *)); if(array == NULL) { fprintf(stderr, "out of memory\n"); return NULL; } for(i = 0; i < rows; i++) { array[i] = (double*) malloc(columns * sizeof(double *)); if(array == NULL) { fprintf(stderr, "out of memory\n"); return NULL; } } return array; } void populateUserFeatureP(double **userFeatureP) { int x,y; for(x = 0; x < CUSTOMERS; x++) { for(y = 0; y < FEATURES; y++) { userFeatureP[x][y] = 0; } } } void populateItemFeatureQ(double **itemFeatureQ) { int x,y; for(x = 0; x < FEATURES; x++) { for(y = 0; y < MOVIES; y++) { printf("(%d,%d)\n", x, y); itemFeatureQ[x][y] = 0; } } } int main(int argc, char *argv[]){ double **userFeatureP = reserveMemory(480189, 40); double **itemFeatureQ = reserveMemory(40, 17770); populateItemFeatureQ(itemFeatureQ); populateUserFeatureP(userFeatureP); return 0; }

    Read the article

  • segmentation fault when using pointer to pointer

    - by user3697730
    I had been trying to use a pointer to pointer in a function,but is seems that I am not doing the memory allocation correctly... My code is: #include<stdio.h> #include<math.h> #include<ctype.h> #include<stdlib.h> #include<string.h> struct list{ int data; struct list *next; }; void abc (struct list **l,struct list **l2) { *l2=NULL; l2=(struct list**)malloc( sizeof(struct list*)); (*l)->data=12; printf("%d",(*l)->data); (*l2)->next=*l2; } int main() { struct list *l,*l2; abc(&l,&l2); system("pause"); return(0); } This code compiles,but I cannot run thw program..I get a segmentation fault..What should I do?Any help would be appreciated!

    Read the article

  • How do I work around sudo 'segmentation fault' on basic bash commands?

    - by sage
    I am sure the answers are out there, but alas there are too many answers (here and elsewhere) to other questions stopping me from finding them. I just encountered something substantially similar to what is described at the closed SO question, sudo : “segmentation fault” Ubuntu maverick [closed]. My team is using Ubuntu 11.04 on VMWare Workstation 8.0.4. We are doing development using c++, Xenomai, Qt, and Qt Creator. When we simulate our application on the virtual machine, we currently need to launch Qt Creator with sudo. My colleague mentioned today that he has been having issues where his workstation locks up and he needs to restart and that occasionally he has the issue that all sudo bash commands return "segmentation fault". I just ran our application in simulation mode. I was running Qt Creator under sudo and Qt Creator received the signal abort (if I recall). Afterward, every command executed with sudo from sudo qtcreator to sudo ls resulted in the message Segmentation fault. I clicked on the power widget to see if I could log out, but the system shut down straightaway without prompting. My understanding is that we run sudo because of a permissions issue with Xenomai and the VM as currently configured, but my colleague has a workaround for this. I expect that not running Qt Creator under sudo -- something that has always made me nervous -- will help contain this issue, but I find it troubling that this could happen and manifest as it does. Does anyone know what is happening? Any recommendations on how to work around this issue? This is happening often to I am trying tolobby for VM changes to be able to run the process without sudo.

    Read the article

  • Segmentation fault when creating a Phonon MediaObject

    - by Luke Hansford
    I have music playing program made using PySide which uses Phonon to playback audio. I updated to MacOS X Mavericks a few days ago, which meant I needed to reinstall PySide. I'm not sure which of these actions has caused this, but now whenever I try to create a Phonon MediaObject I get a Segmentation Fault: 11 from Python. It's not just in my program, it happens when trying to create a MediaObject in Python without any other actions. I'm getting the following error message from my Mac whenever it crashes: Process: Python [13711] Path: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python Identifier: org.python.python Version: 2.7.5 (2.7.5) Code Type: X86-64 (Native) Parent Process: bash [13707] Responsible: Terminal [13704] User ID: 501 Date/Time: 2013-11-01 19:47:53.164 +1000 OS Version: Mac OS X 10.9 (13A603) Report Version: 11 Anonymous UUID: C2686854-18CA-9D37-26E9-60050E3C4DA6 Sleep/Wake UUID: BB983BF6-CCE2-44D1-82A0-1C73382DFFE4 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008 VM Regions Near 0x8: --> __TEXT 00000001082e8000-00000001082e9000 [ 4K] r-x/rwx SM=COW /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 QtCore 0x000000010a1b34cb QObject::moveToThread(QThread*) + 17 1 QtDBus 0x000000010d55f98b QDBusDefaultConnection::QDBusDefaultConnection(QDBusConnection::BusType, char const*) + 171 2 QtDBus 0x000000010d55ebdf QDBusConnection::sessionBus() + 71 3 phonon 0x000000010d50228d Phonon::FactoryPrivate::FactoryPrivate() + 189 4 phonon 0x000000010d5024d5 Phonon::$_249::operator->() + 99 5 phonon 0x000000010d502991 Phonon::Factory::registerFrontendObject(Phonon::MediaNodePrivate*) + 17 6 phonon 0x000000010d50b27e Phonon::MediaNodePrivate::MediaNodePrivate(Phonon::MediaNodePrivate::CastId) + 80 7 phonon 0x000000010d50f570 Phonon::MediaObjectPrivate::MediaObjectPrivate() + 24 8 phonon 0x000000010d50be9d Phonon::MediaObject::MediaObject(QObject*) + 45 9 phonon.so 0x000000010d42f24a Sbk_Phonon_MediaObject_Init + 458 10 org.python.python 0x0000000108338707 type_call + 189 11 org.python.python 0x00000001082f74fd PyObject_Call + 101 12 org.python.python 0x00000001083714f0 PyEval_EvalFrameEx + 15525 13 org.python.python 0x0000000108373aaf fast_function + 182 14 org.python.python 0x0000000108370919 PyEval_EvalFrameEx + 12494 15 org.python.python 0x000000010836d721 PyEval_EvalCodeEx + 1638 16 org.python.python 0x000000010836d0b5 PyEval_EvalCode + 54 17 org.python.python 0x000000010838beb8 run_mod + 53 18 org.python.python 0x000000010838bf5f PyRun_FileExFlags + 137 19 org.python.python 0x000000010838baad PyRun_SimpleFileExFlags + 718 20 org.python.python 0x000000010839c58b Py_Main + 3039 21 libdyld.dylib 0x00007fff8e4fb5fd start + 1 Thread 1:: Dispatch queue: com.apple.libdispatch-manager 0 libsystem_kernel.dylib 0x00007fff8c938662 kevent64 + 10 1 libdispatch.dylib 0x00007fff923e743d _dispatch_mgr_invoke + 239 2 libdispatch.dylib 0x00007fff923e7152 _dispatch_mgr_thread + 52 Thread 2: 0 libsystem_kernel.dylib 0x00007fff8c937e6a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff90bd8f08 _pthread_wqthread + 330 2 libsystem_pthread.dylib 0x00007fff90bdbfb9 start_wqthread + 13 Thread 3: 0 libsystem_kernel.dylib 0x00007fff8c937e6a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff90bd8f08 _pthread_wqthread + 330 2 libsystem_pthread.dylib 0x00007fff90bdbfb9 start_wqthread + 13 Thread 4: 0 libsystem_kernel.dylib 0x00007fff8c937e6a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff90bd8f08 _pthread_wqthread + 330 2 libsystem_pthread.dylib 0x00007fff90bdbfb9 start_wqthread + 13 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x00007feba0d19700 rbx: 0x000000010d5b7098 rcx: 0x00000000002f4180 rdx: 0x000000000012c040 rdi: 0x0000000000000000 rsi: 0x00007feba0d19700 rbp: 0x00007fff57917210 rsp: 0x00007fff579171d0 r8: 0x00007feba0fd5d10 r9: 0x00007feba0ff5310 r10: 0x0000000019c04cbe r11: 0x0000000070769b38 r12: 0x00007fff57917220 r13: 0x00007feba0c07190 r14: 0x0000000000000000 r15: 0x00007feba0fe1430 rip: 0x000000010a1b34cb rfl: 0x0000000000010202 cr2: 0x0000000000000008 Logical CPU: 0 Error Code: 0x00000004 Trap Number: 14 Anyone have any ideas about what is happening?

    Read the article

  • Structs, strtok, segmentation fault

    - by FILIaS
    I'm trying to make a programme with structs and files.The following is just a part of my code(it;s not all). What i'm trying to do is: ask the user to write his command. eg. delete John eg. enter John James 5000 ipad purchase. The problem is that I want to split the command in order to save its 'args' for a struct element. That's why i used strtok. BUT I'm facing another problem in who to 'put' these on the struct. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 100 char command[1500]; struct catalogue { char short_name[50]; char surname[50]; signed int amount; char description[1000]; }*catalog[MAX]; int main ( int argc, char *argv[] ) { int i,n; char choice[3]; printf(">sort1: Print savings sorted by surname\n"); printf(">sort2: Print savings sorted by amount\n"); printf(">search+name:Print savings of each name searched\n"); printf(">delete+full_name+amount: Erase saving\n"); printf(">enter+full_name+amount+description: Enter saving \n"); printf(">quit: Update + EXIT program.\n"); printf("Choose your selection:\n>"); gets(command); //it save the whole command /*in choice it;s saved only the first 2 letters(needed for menu choice again)*/ strncpy(choice,command,2); choice[2]='\0'; char** args = (char**)malloc(strlen(command)*sizeof(char*)); memset(args, 0, sizeof(char*)*strlen(command)); char* curToken = strtok(command, " \t"); for (n = 0; curToken != NULL; ++n) { args[n] = strdup(curToken); curToken = strtok(NULL, " \t"); *catalog[n]->short_name=*args[1]; *catalog[n]->surname=args[2]; catalog[n]->amount=atoi(args[3]); *catalog[n]->description=args[4]; } return 0; } I get a warning (warning: assignment makes integer from pointer without a cast) for the lines: *catalog[n]->short_name=*args[1]; *catalog[n]->surname=args[2]; *catalog[n]->description=args[4]; As a result, after running the program i get a Segmentation Fault... Any help? Any ideas?

    Read the article

  • global static boolean pointer causes segmentation fault using pthread

    - by asksw0rder
    New to pthread programming, and stuck on this error when working on a C++&C mixed code. What I have done is to call the c code in the thread created by the c++ code. There is a static boolean pointer used in the thread and should got free when the thread finishes. However I noticed that every time when the program processed into the c function, the value of the boolean pointer would be changed and the segmentation fault then happened due to the free(). Detail code is as follows: static bool *is_center; // omit other codes in between ... void streamCluster( PStream* stream) { // some code here ... while(1){ // some code here ... is_center = (bool*)calloc(points.num,sizeof(bool)); // start the parallel thread here. // the c code is invoked in this function. localSearch(&points,kmin, kmax,&kfinal); // parallel free(is_center); } And the function using parallel is as follows (my c code is invoked in each thread): void localSearch( Points* points, long kmin, long kmax, long* kfinal ) { pthread_barrier_t barrier; pthread_t* threads = new pthread_t[nproc]; pkmedian_arg_t* arg = new pkmedian_arg_t[nproc]; pthread_barrier_init(&barrier,NULL,nproc); for( int i = 0; i < nproc; i++ ) { arg[i].points = points; arg[i].kmin = kmin; arg[i].kmax = kmax; arg[i].pid = i; arg[i].kfinal = kfinal; arg[i].barrier = &barrier; pthread_create(threads+i,NULL,localSearchSub,(void*)&arg[i]); } for ( int i = 0; i < nproc; i++) { pthread_join(threads[i],NULL); } delete[] threads; delete[] arg; pthread_barrier_destroy(&barrier); } Finally the function calling my c code: void* localSearchSub(void* arg_) { // omit some initialize code... // my code begin_papi_thread(&eventSet); // Processing k-means, omit codes. // is_center value will be updated correctly // my code end_papi_thread(&eventSet); // when jumping into this, error happens return NULL; } And from gdb, what I have got for the is_center is: Breakpoint 2, localSearchSub (arg_=0x600000000000bc40) at streamcluster.cpp:1711 1711 end_papi_thread(&eventSet); (gdb) s Hardware watchpoint 1: is_center Old value = (bool *) 0x600000000000bba0 New value = (bool *) 0xa93f3 0x400000000000d8d1 in localSearchSub (arg_=0x600000000000bc40) at streamcluster.cpp:1711 1711 end_papi_thread(&eventSet); Any suggestions? Thanks in advance!

    Read the article

  • WCF JSON Service returns XML on Fault

    - by Anthony Johnston
    I am running a ServiceHost to test one of my services and all works fine until I throw a FaultException - bang I get XML not JSON my service contract - lovely /// <summary> /// <para>Get category by id</para> /// </summary> [OperationContract(AsyncPattern = true)] [FaultContract(typeof(CategoryNotFound))] [FaultContract(typeof(UnexpectedExceptionDetail))] IAsyncResult BeginCategoryById( CategoryByIdRequest request, AsyncCallback callback, object state); CategoryByIdResponse EndCategoryById(IAsyncResult result); Host Set-up - scrummy yum var host = new ServiceHost(serviceType, new Uri(serviceUrl)); host.AddServiceEndpoint( serviceContract, new WebHttpBinding(), "") .Behaviors.Add( new WebHttpBehavior { DefaultBodyStyle = WebMessageBodyStyle.Bare, DefaultOutgoingResponseFormat = WebMessageFormat.Json, FaultExceptionEnabled = true }); host.Open(); Here's the call - oo belly ache var request = WebRequest.Create(serviceUrl + "/" + serviceName); request.Method = "POST"; request.ContentType = "application/json; charset=utf-8"; request.ContentLength = 0; try { // receive response using (var response = request.GetResponse()) { var responseStream = response.GetResponseStream(); // convert back into referenced object for verification var deserialiser = new DataContractJsonSerializer(typeof (TResponseData)); return (TResponseData) deserialiser.ReadObject(responseStream); } } catch (WebException wex) { var response = wex.Response; using (var responseStream = response.GetResponseStream()) { // convert back into fault //var deserialiser = new DataContractJsonSerializer(typeof(FaultException<CategoryNotFound>)); //var fex = (FaultException<CategoryNotFound>)deserialiser.ReadObject(responseStream); var text = new StreamReader(responseStream).ReadToEnd(); var fex = new Exception(text, wex); Logger.Error(fex); throw fex; } } the text var contains the correct fault, but serialized as Xml What have I done wrong here?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >