- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Core file (segmentation fault) strings help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2002 01:06 PM
тАО02-05-2002 01:06 PM
Core file (segmentation fault) strings help
It works on HP-UX and on MPE/IX but I can't get it to run on Linux.
I'll attach the core file (if I can).
Any help would be greatly appreciated.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2002 01:08 AM
тАО02-06-2002 01:08 AM
Re: Core file (segmentation fault) strings help
Qus. What's the program do, written in, O/S's involved ? Source code eg ?
try a "file core" or try using one of the debuggers in /opt/langtools/bin : dde,gdb or wdb ?
You may also find the following URL useful :
http://devresource.hp.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2002 10:45 AM
тАО02-06-2002 10:45 AM
Re: Core file (segmentation fault) strings help
So basically a benchmark app. It opens TCP sockets, makes a random booking on a random date, random to and from destinations, etc.
So, compiled on Linux to connect to the 3000. He did have a lot of compile errors, but has fixed them so it compiles with no errors.
What is a Segmentation Fault? Is it any clue as to the problem?
Thanks again. I can probably send you the .c file (code) if you think you can help.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2002 06:33 AM
тАО02-15-2002 06:33 AM
Re: Core file (segmentation fault) strings help
This can happen for a lot of reasons.
The easiest way to find out where the seg fault came from is load your core file in gdb and do a backtrace. That will show you where in the call stack the program died (provided the program was compiled with the -g option).
Several of the routine names should be recognizable to you and you should be able to narrow it down to the line of code that dies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2002 09:18 AM
тАО02-15-2002 09:18 AM
Re: Core file (segmentation fault) strings help
The problem seems to occur on Socket Receives.
Is there something about sockets that's different on Linux vs. HP-UX?
Thanks,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2002 09:45 AM
тАО02-15-2002 09:45 AM
Re: Core file (segmentation fault) strings help
I see there are some flags not in common between Linux and HP.
Also, note that the recv will fail if the connect prior to the first recv failed (i.e. trying to recv from a null socket). Error checking might be in order, but that only pushes up your problem to the socket connection itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2002 10:22 AM
тАО02-15-2002 10:22 AM
Re: Core file (segmentation fault) strings help
Have a look at the code see if you see anything.
int connect_socket()
{
int addrlen = 0;
struct sockaddr_in serveraddr;
if ((fSock=socket(AF_INET,SOCK_STREAM,0)) < 0) {
perror("Client Socket call Error(1)");
printf("Client Socket call Error(1)[%d]\n", sys_pin);
return -1;
}
serveraddr.sin_addr.s_addr = inet_addr(SERV_HOST_ADDR);
serveraddr.sin_port = htons(SERV_TCP_PORT);
serveraddr.sin_family = AF_INET;
addrlen=sizeof(struct sockaddr_in);
if (connect(fSock, (struct sockaddr *) &serveraddr, addrlen) < 0) {
perror("Client Connect call Error(2)");
printf("Client Connect call Error(2)[%d]\n", sys_pin);
return -1;
}
return 0;
}
int recv_it(char *spStatInfo,char *spStatSub)
{
char id[3] = " ";
char code[3] = " ";
struct timeval timeout;
int retval = 0;
int data_len = 0;
int total = 0;
int len = 0;
int hsize = 8;
int period = 180;
int iStatus = 0;
fd_set readmask;
FD_ZERO(&readmask);
FD_SET(fSock,&readmask);
timeout.tv_sec = period;
timeout.tv_usec = 0;
retval = select(fSock + 1, (fd_set *) &readmask, NULL, NULL, &timeout);
if (retval < 0) {
iStatus = ERRORSELECT;
printf("Socket select error(1).[%d]\n", sys_pin);
return iStatus;
}
else if (retval == 0) {
iStatus = TIMEDOUT;
printf("Socket TimeOut/Error(1).[%d]\n", sys_pin);
return iStatus;
}
else if (!FD_ISSET(fSock, &readmask)) {
iStatus = ERRORSOCKSELECT;
printf("Socket ErrorSelect(1).[%d]\n", sys_pin);
return iStatus;
}
len = recv(fSock, (char *) &osreturn, hsize, 0);
if (len < hsize) {
iStatus = ERRORRECV;
printf("Socket Receive/Error(1).[%d]\n", sys_pin);
return iStatus;
}
data_len = osreturn.mh.iHeaderLen - hsize;
memset(osreturn.md.data,32,strlen(osreturn.md.data));
while (total < data_len) {
FD_ZERO(&readmask);
FD_SET(fSock, &readmask);
timeout.tv_sec = period;
timeout.tv_usec = 0;
retval = select(fSock + 1, (fd_set *) &readmask, NULL, NULL, &timeout);
if (retval < 0) {
iStatus = ERRORSELECT;
printf("Socket ErrorSelect(2).[%d]\n", sys_pin);
break;
}
else if (retval == 0) {
iStatus = TIMEDOUT;
printf("Socket TimeOut/Error(2).[%d]\n", sys_pin);
break;
}
else if (!FD_ISSET(fSock, &readmask)) {
iStatus = ERRORSOCKSELECT;
printf("Socket ErrorSockSelect(2).[%d]\n", sys_pin);
break;
}
len = recv(fSock, (char *) &osreturn+hsize+total, sizeof(osreturn), 0);
if (len <= 0) {
iStatus = ERRORRECV;
printf("Socket Receive/Error(2).[%d]\n", sys_pin);
break;
}
total += len;
}
if(iStatus != 0) return iStatus;
process_transaction(code);
return iStatus;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2002 11:35 AM
тАО02-15-2002 11:35 AM
Re: Core file (segmentation fault) strings help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2002 01:08 PM
тАО02-15-2002 01:08 PM
Re: Core file (segmentation fault) strings help
First of all a HUGE THANKS FOR YOUR HELP.
it looks like 'iHeaderLen' is getting trashed somehow ... ask if they see anything wrong with the way i have my structures..
typedef struct {
char pacRecipient[4];
int iHeaderLen;
char module_id[2];
char trans_code[2];
char more_flag[1];
char statinfo[4];
char subsys[4];
char version[3];
char tell_flag[1];
char filler[3];
} OSMSGHDR;
typedef union { /* send/reveive buffers to orsrvr */
char data[DATA_SIZE];
struct { /* Error */
char statinfo[4];
char subsys[4];
char textlen[4];
char error_text[80];
char last[1];
} error;
struct { /* Login */
char airline_code[4];
char user_name[8];
char term_id[50];
char temp_login_flag[1];
char new_pass_flag[1];
char new_pass[8];
char password[8];
char server_id[8];
char logon_date[8];
char logon_time[4];
char user_group[8];
char group_desc[40];
char res_prop[20];
char res_max_pax[3];
char res1_prop[20];
char last[1];
} login;
/*others .... removed for example */
} OSMSGDATA;
typedef struct {
OSMSGHDR mh;
OSMSGDATA md;
} OSMSGBUFF;
OSMSGBUFF osbuff;
OSMSGBUFF osreturn;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-18-2002 06:27 AM
тАО02-18-2002 06:27 AM
Re: Core file (segmentation fault) strings help
It may be an application issue of where the incoming data is transfered to the user defined structures.