gdb debug remote core dump - c++

I have a server written in C++ crashing in the production environment to which I have no direct access to. The crash generates a huge core dump ~34G which I cannot copy locally. I need to analyze the core dump but don't know how it can be done without copying it over. I tried running gdbserver on target but it doesn't take a core file as a parameter and seems only good for debugging running remote applications from a host machine. Is there a way this can be done?

I need to analyze the core dump but don't know how it can be done without copying it over.
You can't. You'll need to get the core dump to where you can run GDB.
I cannot ssh to the remote machine but can ask the sys admin to run something like gdbserver for me but he cannot analyze and debug the core file.
You don't need sysadmin to analyze anything. You just need to ask him to run a series of GDB commands, and send you the output. E.g.
where
thread apply all where
info registers
disas
... will get you a long way to understanding the problem, and will take your sysadmin less than 5 minutes.
I still will need to uncompress it to run it on gdb which I don't want to do on my local machine.
Also, talk to your manager. Your development setup is unreasonable. You have to be able to analyze production crashes locally, and that means you have to have access to a sufficiently beefy machine.

Related

WSO2 does not start; The process is being killed

I installed wso2 on linux server. When I want to run the application with the sh wso2server.sh command in the bin file, "Killed" appears on the console screen and the application does not work. I also tried with the sh wso2server start command. It still didn't work. There is no error when I look at the log files. What is the reason for this and how can I solve it?
It seems the Operating System is Killing your process. One reason for this is you do not have enough memory in the VM to start the Java process. So first check whether you have allocated enough memory to this VM?
If that's not the case, you should be able to find more information from the Kernal logs to determine why the process was killed. Typically located at /var/log/kern.log or /var/log/dmesg.
Have a look at this question as well.

Starting sas job from remote computer

I have a scheduling program running on Server A running Windows 2008 RS. Server B is my SAS server under Windows 2008 R2. How do I kick-off a job on SAS server from my scheduling server? I can either use the sas.exe or a batch file to start my job. Owners of the SAS server tell me that I cannot add an application or Windows service to the SAS server. Is this even possible?
Below is a copy of my answer to a slightly different question (source: http://www.runsubmit.com/questions/260/hide-sas-batch-jobs-winxp). I'm copy/pasting it here for perpetuity and also because it's more likely to help people searching:
You can use PsExec which is part of Microsoft/Sysinternals list of utility programs. This file will go on the scheduling server. Grab it from here:
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
The tool is designed to allow you to execute jobs on remote machines. For example, if you want to launch a SAS program from the command line you could run:
psexec \\machinename sas.exe -sysin remotedrivename:\remotefolder\myprogram.sas
This would launch SAS.EXE on the remote machine and run the supplied program that exists on the remote machine. When it launches SAS it appears to launch it within a PsServ service. Because it's running within a service no interface will be displayed. I'm not even sure if you would see it appear as it's own process or application in windows task manager. If you use SysInternals other program, ProcessExplorer, instead of Task Manager you can see this happening.
Note that the REMOTE MACHINE and the LOCAL machine can be the same machine.
PROS: Many other uses for this technique. It's free. PsExec is only required on the machine that is making the call, not both machines.
CONS: Its a bit of a roundabout way to do things. Need to install a third party program (although it is now a MS tool). Some antivirus programs/network admins may not allow it.
Note that if your SAS jobs access network resources then you will probably need to make the network resource available first using the net map command. I suggest running your sas job in a batch file like so (or use the 'x' command from within your SAS file to call the 'net use' commands):
Command executed from local machine:
psexec \\machinename -sysin remotedrivename:\remotefolder\myprogram.BAT
Contents of batch file on remote machine:
net use m: \\fileserver\sharedfolder /USER:mynetworkdomainname\myusername mypassword
sas.exe -sysin remotedrivename:\remotefolder\myprogram.sas
net use m: /delete

Remote launching C++ apps

My problem is simple, I have 1 computer conected to many powerfull servers. I want to execute the app locally but run the process (heavy load) in the remote servers.
The app+settings vary a lot, and I want that this exactly version of the app+settings folder to be used by the remote instances.
My approach so far:
Launch the app locally
Use PSEXEC to remote launch the same executable as it is running in local -> in the servers (with a random port number passed by argument)
Contect to them via sockets
Send commands to execute remotely and get the results
My problem relies in the config files, wich are many(50+) and some of them +4MB. This config files are TXT files in a config folder.
What is the proper way to do it? Is it possible to use PSEXEC to copy remotely a whole folder? Can I do any good trick on the sockets to directly pass a copy of the local files to remote?
I would like all the process to be semi-transparent. Since many people will use it with different versions and settings at the same time. So manually copying the files to 20+servers is NOT an option.
Thank you!
Put the program/script that you want to execute by all machines on one common location on local network (put your configs there too). On all servers create a batch file say 'runme.bat' that will execute your program directly from network location.
This way you can use psexec to run runme.bat essentially executing your program/script on any server you want.
Since often - there are issues using psexec - you may invoke your scripts from Task Scheduler etc.
I do that for 500+ servers and it works. If working for me it will work for you.
You might want to look at HTCondor (http://research.cs.wisc.edu/htcondor/) which could perhaps manage all of this for you.

How remote debugging is implemented in general

I have been using remote debugging from JDeveloper to Weblogic server for quite sometime and found it's very useful. But I am interested in understanding how remote debugging is implemented technically.
When I make any java code change and rebuild the class in jdeveloper on a remote machine from where I am debugging the server, the code changes are automatically picked up the server. How does this happen? Does the tool send the compiled java class on the network to server?
Can any one please share any documents / links explaining the technicalities of remote debugging.
Thanks & Regards,
Harish
Not sure if you're asking about remote debugging in general, or for the particular tools you're describing.
I don't know much about Java/jdeveloper, but in general remote debugging works as follows:
On the target machine, a special server process hooks into the executable you want to debug, just like a debugger would when running locally. This server doesn't have to know about symbols and source code, just have the executable running. Using system commands it can ask it to stop and examine its memory space.
On the host machine the debugger itself runs and also has a copy of the executable, and of its source code. The debugger communicates with the server on the target machine using some kind of protocol (TCP/IP or maybe serial for embedded devices) and asks it to step, examines certain memory locations it knows about from the debug info in the executable, can show the source code being debugged to the user, etc.
Read, for example, on gdbserver which is probably the most popular remote debugging server out there.
Hope this helps :)

how to read list of running processes on a remote computer in C++

What can be done to know and list all running processes on a remote computer?
One idea is to have a server listening to our request on the remote machine and the other one is to use ssh.
The problem is i dont know whether there will be such a server running on the remote machine and i cannot use ssh because it needs authentication.
Is there any other way out ?
If you
cannot install a server program on the remote machine
cannot use anything that requires authentication
then you should not be allowed to know the list of all running processes on a machine. That request would be a security nightmare!
You can do something much simpler without (as many) security problems: scan the publicly-available ports for programs that are running. Programs like nmap.org let you know a fair bit of information about the publicly-running programs on machines.
I have done something similar in the past using SNMP. I don't have the specifics in front of me, but something like "snmpwalk -v2 -c public hostname prTable" got me the process table. I recall later configuring SNMP to generate errors when the number of processes didn't meet our specified requirement, like httpd must have at least 1 and less than 50.
I suggest you look at the code for a remote login, rlogin. You could remotely login to an account that has the privileges that you need. Once logged in, you can fetch a list of processes.
This looks like a good application for a script rather than a C or C++ program.