Programming :: Segfault In Program Using Pthreads

Mar 16, 2010

I am trying to write a peer to peer application in C++ using pthreads library. There are few types of nodes that run in the program. The 'beacon' nodes form the core of the network. The ordinary nodes 'join' the network by sending join requests to the beacon node. So, my program runs till the join requests and responses are received. When I try to 'connect' using connect function from the socket library, I get a segfault. I am not sure if the segfault occurs for the connect function, because sometimes the program just runs to completion. It could be an issue related to threads or memory allocation.

When I run gdb, it shows me the following:
Code:
(gdb) run b2-n00.ini
Starting program: sv_node b2-n00.ini
servant:12600> [New LWP 1]
[New LWP 2]
[New LWP 3]
[New LWP 4]
[New LWP 5]
[New LWP 6]
Before Exiting[LWP 1 exited]
procfs: fetch_registers, get_gregs line 3768, /proc/23952/lwp/1: No such file or directory.

View 6 Replies


ADVERTISEMENT

Programming :: Preemption And Scheduling Of Pthreads

Feb 10, 2010

i think we can simulate preemption by using 2 different priority thread, am i true? I just try these scenario :
1. Create Thread A with priority 99 , SCHED_FIFO..
2. Create Thread B with priority 4 , SCHED_FIFO

Thread A started and doing some busy work.. I guess that Thread B wouldn't start until thread A finished, but I get thread B can run before Thread A finished (It just like a common task switching).. I'm sure my 2 thread has right priority. and if thread B is doing some work and if i yield it to thread A, it should preempt it but this doesnt happen, do someone kno wats happening?

View 1 Replies View Related

Programming :: Suspend Pthreads Without Condition

Jun 29, 2010

I just started with Pthreads and don't really know much about it. I want to suspend pthreads but apparently, there is no such function as pthread_suspend. but I don't understand why we need both mutex and condition to suspend and resume a pthread. Is it possible to suspend and resume it without using conditions?

View 1 Replies View Related

Programming :: Pthreads Return Value Valid Or Not

Jun 14, 2010

I have confusion regarding pthreads return value. All in short, is the is a valid return value ?

[source]
void * myThrRoutine(void *arg)
{
struct myStruct **myst = (struct myStruct**) arg;
cout<<"In thread "<<(*myst)->var<<(*myst)->msg<<endl;
int x = 20;
pthread_exit((void*)x);
}
[/source]

This seems to work fine on pthread_join , but I want to ensure it is not by chance.

View 1 Replies View Related

Programming :: Using Lock In OpenMP And Pthreads

Apr 14, 2011

I have a program that uses both Pthreads and OpenMP. Basically, 2 threads (Thread A and B) are created using Pthreads to do work, and in Thread A, OpenMP is used to parallelize a for loop.If I have a global variable that is accessed by the OpenMP threads and also Thread B, can I use the lock in OpenMP to ensure I have no race conditions?

View 2 Replies View Related

Programming :: Is Popen Thread Safe Via Pthreads?

Sep 17, 2010

I don't seem to find a conclusive answer to this one...."Is popen thread safe via pthreads?"

View 2 Replies View Related

Slackware :: Upgrade To 13.1 Causes Segfault In Program That Ran Under 13.0

Mar 10, 2011

I have a custom program that has been running on Slackware since about 2004. It was running fine on Slackware 13.0, but an upgrade (following the procedure in UPGRADE.TXT) to 13.1 causes the program to segfault on a read/write op to the serial port (details here).

what might have changed between 13.0 and 13.1 that might affect serial port programming? I've been through CHANGES_AND_HINTS but nothing is jumping out at me.

View 14 Replies View Related

Programming :: Related To Pthreads And Timers In POSIX Standard

Feb 17, 2010

I have created two threads:
Thread 1 and thread 2

In the main thread, i have put up a timer which generates a signal periodically when it expires, which reults in execution going to signal catcher function.when this function is invoked, under certain condition it goes to thread 1 and under another condition it goes to thread 2. The problem lies here that when it goes to thread2,i have a loop to process but it doesnt come out of the loop and hence from thread2, even though timer has expired.

View 2 Replies View Related

Programming :: C - Malloc Causing Segfault?

Mar 20, 2010

Code:
#include <stdio.h>
#include <stdlib.h>

[code]...

View 3 Replies View Related

Programming :: C - Segfault During Malloc. How To Use The Pointers

Mar 23, 2010

So the place where I'm having a problem is here:

Code:
typedef struct {
void **Mem_Chunk;

[code]...

View 10 Replies View Related

Programming :: Fortran - Array-valued Function Leads To Segfault?

Jun 8, 2010

I'm trying to implement a solver for a system of differential equations in Fortran. The solver contains a number of functions which are supposed take real values, 1D arrays of real values or both as arguments and return arrays of real numbers, all of which cause the program to segfault. Example:

Code:

function y_exakt(t)
implicit none
real::t, pi

[code]....

(the last number in the array seems to change randomly). Then the program crashes either when f(t,y) is called or when dy is returned (after removing the call to f). What could cause these (memory?) problems and/or what could I do to identify the problem? Increasing the maximum stack size with ulimit or compiling the program with -fno-automatic has had no effect. I'm using gfortran (gcc 4.4.3) on a 64-bit Ubuntu Lucid machine. The complete program can be found at [URL].

View 3 Replies View Related

Programming :: Program A SH - Bash Program With Zenity To Play Radio Based On A Site?

Feb 15, 2011

I will have to code this. However I am lacking of time since I have too much to do. make a short code bash/dash to prompt the country with Zenity, then, get the PLS or m3u url and prompt with another zenity which radio to play. http://www.listenlive.eu/index.html

My code to get url's radio country.htm is:

Code:

View 2 Replies View Related

General :: Pthreads - Structure Can Be Returned With Value

May 21, 2010

I am playing around with pthreads. This program however blows up.

#include <iostream>
#include <pthread.h>
using namespace std;
struct myStruct
{
int a;
string msg;
};

void * myProc(void *arg)
{
struct myStruct* str = new struct myStruct();
str->a = 10;
str->msg ="hi";
return (void*)str;
}

int main(int argc, char **argv)
{
pthread_t mythr;
int status ;
void *retVal;
struct myStruct* m_str;
status = pthread_create(&mythr,NULL,myProc,NULL);
status = pthread_join(mythr,&retVal);
cout<<"Status is"<<status<<endl;
m_str = (struct myStruct*)m_str;
cout<<"retval is "<<m_str->a<<" "<<endl;
return 0;
}

Can a structure be returned by a thread as its return value ?

View 1 Replies View Related

General :: Pthreads - Executing Two Different Functions Simultaneously

Jul 1, 2011

In my code I want to have two different functions to be executed simultaneously (in parallel) in a single processor system. I tried to use pthreads but they happened to be executed one after another. I have heard about fork, some saying that its no longer recommended since its functions can be achieved by pthreads.

View 1 Replies View Related

Programming :: Open Or Run A File/program Through A C++ Program

Jan 15, 2010

Ok so Basically i have 2 questions

1. i know how to create a file with c++ using but is there a way to save it to a specific location on your computer with windows and linux

Code:

2. i need to know how to run/execute/open a file in a c++ program im using and its not working

Code:

View 4 Replies View Related

Programming :: Build A Simple Program For C Programming Class?

Feb 12, 2011

im trying to build a simple program for my C programming class, this is the source code

#include <stdio.h>
int main()
{
int length, width, length, height, area, perimeter;
perimeter = width + length + height;
area = width * length + heigth;

[Code]...

i dont see any error (you might)but every time i run it it runs but after it asks me to input for the width i do it but it doesn't take me to the length, it just stays blank until i input another value in the same place for the width, it asks me for 4 inputs in total i don;t know why, and after i run it different times it gives me different values for the perimeter and are. how can I fix this?

View 5 Replies View Related

OpenSUSE :: Automount: Segfault At ... In Lookup_hosts.so?

Feb 4, 2010

automount[9052]: segfault at 60 ip 00007f75c15bcd7c sp 00007f75c0753c30 error 4 in lookup_hosts.so[7f75c15b6000+1b000]/etc/hosts...10.226.219.46 zbv6 zbv6.gud.s.atcd /net/zbv6/home

View 2 Replies View Related

Ubuntu Multimedia :: PSX Crashes With A Segfault?

Feb 19, 2010

When attempting to run pSX on Ubuntu 9.04 (and the 9.10 livecd), it crashes with a segfault. I -have- read [URL] and tried shutting down pulseaudio as recommended there. However:

Code:
$ sudo /etc/init.d/pulseaudio stop
* PulseAudio configured for per-user sessions
$ sudo killall pulseaudio

[Code]....

How do I get pSX working? I tried copying the psx.ini file from another machine because the thread says pSX works fine after you change the sound device used, but it still segfaults when I try running it.

View 2 Replies View Related

Ubuntu :: Compiz SegFault Randomly In 11.04?

May 6, 2011

I am on a fresh install of Narwal. I've switched to classic because unity wasn't mature enough IMO. Just installed ccsm and now my display will crash randomly after running for a short while.

Code:
daniel@orange:~$ compiz --replace --debug
compiz (core) - Debug: Could not stat() file /home/daniel/.compiz-1/plugins/libcore.so :

[code]....

View 2 Replies View Related

Software :: How To Debug Ns-2 Code For Segfault

Jun 14, 2010

Code:
$ cat segfault.c
int main(void)
{
char *s = "hello world";
*s = 'H';

[Code]....

So, now we know where exactly the problem occures. I know only these three commands to debug using gdb. But in case of ns-2 code, I don't know how to use gdb.

I changed a routing protocol's C++ code in ns-2 and successfully recompiled ns-2 but when I run any tcl script with that particular protocol, I get 'segmentation fault'. Now I want to trace what part of the code is causing this. I have tried using 'printf's at suspectable places. Is this possible to debug ns-2 code with gdb just like the segfault.c above? I am useing fedora 9.

View 14 Replies View Related

Slackware :: Gs Segfault When Joining Pdf Files?

Dec 28, 2010

I usually use the following command to join several PDF files in one :gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input1.pdf input2.pdfHadn't have to do it for a while but today, I needed it and thus fired my script.lam! gs segfaults.A quick internet search and I found this :https://bugs.archlinux.org/task/22006Though Arch related, while I'm running slackware64-current, the behaviour was exactly the same as mine.In the above thread, one guy linked to a bug report which seems to be theculprit :http://bugs.ghostscript.com/show_bug.cgi?id=691831gcc 4.5.1, gs 9.00, x86_64, indeed, slackware64 seems to be exactly in that situation.

View 2 Replies View Related

Slackware :: Execute Skype 2.1.0.81 Getting Segfault

Apr 28, 2010

Has anyone had any luck getting a slackbuild to work with the newest version of skype 2.1.0.81? I tried with the static binary but when I go to execute skype I get a segfault. I also tried with a different slackbuild and it doesn't work either.

View 9 Replies View Related

Slackware :: XDM Segfault After Upgrading To RC1 1337

Mar 10, 2011

I encountered "xdm segfault" error due to libXt upgrade. startx worked, but xdm failed. Should be same bug as this link: [URL]

View 3 Replies View Related

CentOS 5 :: Npviewer.bin Crash With The Segfault?

Jul 7, 2009

when open an pdf and close the tab/windows at firefox I get the error at syslog: kernel: npviewer.bin[21396]: segfault at 0000001000000000 rip 00000030abe2646c rsp 00007fffb0978ca0 error 4

I use the last Acrobat Reader.CentOS 5.3 x86_64

View 6 Replies View Related

CentOS 5 :: Mod-php Causing Apache To Segfault?

Sep 22, 2010

I have a newly installed centos 5.5 x86_64 running as a guest on a xen environment. I've installed httpd, mysql, php, mod-php, cacti and some how mod-php i causing apache to exit with segmentation fault. I don't understand whats causing the problem, I have similar boxes with the same setup that works.

[Wed Sep 22 09:19:47 2010] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Wed Sep 22 09:20:11 2010] [notice] child pid 3040 exit signal Segmentation fault (11)

View 1 Replies View Related

Debian :: Colord-sane Segfault During Boot

Sep 6, 2015

I just saw this message in the syslog and wondered if it could have anything to do with my previous problems with LXDE crashing:

Code: Select allSepĀ  6 08:03:34 MyComputer kernel: [ 1003.788502] colord-sane[3381]: segfault at 21 ip b4de95ba sp b5609fb8 error 6 in libdbus-1.so.3.7.2[b4dbe000+4a000]

I have read a number of bug reports regarding this issue and it appears to go back about two years. It was supposedly fixed but that does not appear to be the case unless there is something peculiar with my Wheezy 7.8 installation.I just found this on a Ubuntu bug report. It is related to a colord-sane but not necessarily exactly the same as what I am experiencing.This is a libsane bug, not a colord bug. If you want to to work around it, change /etc/colord.conf to have UseSANE=false

View 2 Replies View Related

Fedora :: Ardour Fails To Start With Segfault

Dec 27, 2010

I recently changed my system from Ubuntu/Suse to Fedora14. Starting Ardour2 or Ardour3 (both build from SVN) or Ardour from the Repo-Package I get this:

[code]...

Ardours Dev Paul Davis thinks, this is an issue with libxml2 but upgrading libxml2 and even downgrading it did not work either. With the fresh install of Fed14 2 weeks ago the Package from the repo did work very much OK. is there anything I can do?

View 3 Replies View Related

Ubuntu :: Unable To Access KDE Desktop Due To Segfault

Apr 16, 2010

For the past few weeks my system has been exhibiting some strange behavior. The first of these instances has been in the form of a total system lockup necessitating a power cycle -- ie. no kernel panic or oops, but cessation of all on-screen activity and an unresponsive mouse and keyboard. ( The first lockup occurred when the monitor was powered down)

Just a few days ago, I started noticing something else : Launching Firefox (3.6.4pre) resulted in it locking up near start-up especially if I was logged into Gmail. After that I experienced a total system lockup and then another one which has placed me in the situation as suggested in the title.

Specifically, KDM and the KDM login manager will start-up and I will be allowed to type my password. Immediately after that when the first of the icons in the KDE start-up animation starts to come into focus the screen goes black and I am returned to the KDM login manager -- I can enter my password again and continue this process ad infinitum.

Trying to diagnose the issue, I attached GDB to KDM. It seems that after I enter my password one or more of the KDE start-up processes dies with signal 1 or to be more specific :

Code:

Program received signal SIGUSR1, User defined signal 1.
0x00007f4ae742d3c3 in select () from /lib/libc.so.6
(gdb) bt full

[code]...

View 3 Replies View Related

Ubuntu :: Get A Segfault Whenever Running Programs With OpenGL?

Oct 24, 2010

I'm running Ubuntu 10.04, and for some reason I get a segfault whenever running programs with OpenGL. I ran "lspci | grep VGA" in the terminal and this is the output:

Code:
02:00.0 VGA compatible controller: ATI Technologies Inc M92 [Mobility Radeon HD 4500 Series]

View 2 Replies View Related

Ubuntu Multimedia :: X11 Segfault With Tri Monitor Dual Gpu

Jul 31, 2011

I have tried to setup a workstation with 3 monitors on two ati videocards, the goal being to span the desktop across all of them.

The process was not difficult at all, but after login X11 crashes and I am left with a console. I am fortunately able to login in safe mode, but I would like to ask for help in debugging this issue.

Here I will try to give as much detail as possible, starting with my system specifications:

Code:

The first card, the ATI Radeon HD 4650 is capable of running two monitors at the same time. The monitors, for all it matters, are three identical ACER P206HV 20" connected with their analog interface (due to missing cables which I will buy soon). Resolution 1600x900 each. My motherboard is an AsRock 870 Extreme3 mounting an AMD Athlon II X4 640 3 GHz processor and 8 GB of RAM.

When asked by Ubuntu, I installed the ATI Caralyst driver version 11.6 and set it up for using Xinerama.

As I said, this setup works fine if I login in safe mode, but crashes X11 otherwise (even in classical mode - no Unity). By inspecting the logs (attached) I found this (notice the segfault)

Code:

As a test, I tryed to configure Catalyst without Xinerama, an this works, but of course I end up with two separate desktop, which is not what I want. In this mode, xrandr seems to work correctly

Code:

After some research I found that XRandR does not support desktop spanning over multiple GPUs, so Xinerama is the only way to go in my case. Since the two are not compatible with each other, after login in safe mode I see that XRandR is disabled

Code:

One more test consisted in disabling the XRandR module in the config files, as found in some posts: edits in /etc/X11/xorg.conf

Code:

configuring the ati driver:

Code:

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved