Answered by:
'System.StackOverflowException' Exception returned if the wrong credentials are submitted

Question
-
I'm getting the following exceprion if I submit the wrong credentials when submitting a Job using the Windows HPC 2008 Job Scheduler:
An unhandled exception of type 'System.StackOverflowException' occurred in Microsoft.Hpc.Scheduler.Store.dll
When I submit the correct credentials the Job is submitted and executed just fine.
The Server we're using is Windows Server 2008 Standard.
Example:
IScheduler
scheduler = new Scheduler();
job.Name = GridJobName;
for (int i = 1; i < NumberOfJobParts + 1; i++)
{
task = job.CreateTask();
task.CommandLine =
"perl " + RunScriptName + " " + scriptArguments + " " + i.ToString() + ";";
job.AddTask(task);
}
job.OnJobState += JobStateCallback;
job.OnTaskState += TaskStateCallback;
scheduler.SubmitJob(job, "User", "Password");
If a Invalid Password is entered in SubmitJob I get the 'System.StackOverflowException' exception.
Any Ideas why this is happening?
Jay FergusonFriday, November 26, 2010 5:04 PM
Answers
-
Hi Jay,
I couldn't reproduce the exception you are getting, however there is one thing you may consider. Default behavior of IScheduler.SubmitJob(), when invalid credentials are provided, is to prompt the user for username and password in console window. This is not possible in case of GUI application, but you can change the behavior to show username/password window instead. To do this, you need to invoke the following method of IScheduler interface: (http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischeduler.setinterfacemode(v=VS.85).aspx)
void SetInterfaceMode ( bool isConsole, IntPtr hwnd )
In WCF you can do it like this (assuming, that this code is a part of your window interaction logic):
WindowInteropHelper helper = new WindowInteropHelper(this);
scheduler.SetInterfaceMode(false, helper.Handle);
In Widows HPC 2008 R2, SetInterfaceMode method supports -1 value for a handle to convert any credential prompt into exception. In your version you can try to use IScheduler.SetCachedCredentials() method to detect if the username or password are incorrect (exception will be thrown). Documentation for this method: http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischeduler.setcachedcredentials(v=VS.85).aspx
Thanks,
Łukasz- Marked as answer by jyferguson Wednesday, December 1, 2010 7:48 PM
Wednesday, December 1, 2010 3:38 PM
All replies
-
Hi Jay,
From the code above I can see, that you are creating Scheduler object, but you are not invoking Connect() method. Is it the real problem or just a copy/paste issue?
Thanks,
ŁukaszMonday, November 29, 2010 5:46 PM -
Hi Lulasz,
I do Invoke the scheduler.Connect() method in my example. I just didn't include it in my example.
Thanks Jay
Jay FergusonTuesday, November 30, 2010 3:33 PM -
Hi Jay,
In what form is your application running? Is it a console app, service?
What is the product version number for your installation? (GUI->Help->About or Console: cluscfg view | findstr /i ver)
Thanks,
ŁukaszTuesday, November 30, 2010 3:39 PM -
Hi Lukasz,
The program is a C# WPF application, not a service.
The ver using the cluscfg view command is 2.2.1841.0
Jay
Jay FergusonTuesday, November 30, 2010 4:48 PM -
Hi Jay,
I couldn't reproduce the exception you are getting, however there is one thing you may consider. Default behavior of IScheduler.SubmitJob(), when invalid credentials are provided, is to prompt the user for username and password in console window. This is not possible in case of GUI application, but you can change the behavior to show username/password window instead. To do this, you need to invoke the following method of IScheduler interface: (http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischeduler.setinterfacemode(v=VS.85).aspx)
void SetInterfaceMode ( bool isConsole, IntPtr hwnd )
In WCF you can do it like this (assuming, that this code is a part of your window interaction logic):
WindowInteropHelper helper = new WindowInteropHelper(this);
scheduler.SetInterfaceMode(false, helper.Handle);
In Widows HPC 2008 R2, SetInterfaceMode method supports -1 value for a handle to convert any credential prompt into exception. In your version you can try to use IScheduler.SetCachedCredentials() method to detect if the username or password are incorrect (exception will be thrown). Documentation for this method: http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischeduler.setcachedcredentials(v=VS.85).aspx
Thanks,
Łukasz- Marked as answer by jyferguson Wednesday, December 1, 2010 7:48 PM
Wednesday, December 1, 2010 3:38 PM -
Hello,
I started recently to work on a Windows HPC 2008 R2 cluster. Instead of using C#, I use a MS-DOS script and command line instructions "job new", "job add" and "job submit" to respectively create, add a task and submit a job. I get a similar error when submitting the job if I don't specify both the user name and the password:
Process is terminated due to StackOverflowException.
However, it works fine if I specify everything or if I log (using remote desktop) directly on the headnode of the cluster, since I don't need to specify credentials in that case.I didn't find an argument in the "job submit" command to specify that I was working in console mode. How should I do that then?
Thank you for your response,
Christophe
PS: here are some more details about the exception, in case it might be useful
AppName: job.exe ; AppVer: 2.1.1703.0; AppStamp:4a49f219;
ModName: credui.dll ; ModVer: 5.1.2600.5512; ModStamp: 4802a0d6;
fDebug: 0; Offset: 00005818- Proposed as answer by tristof Tuesday, January 25, 2011 10:15 AM
Tuesday, January 25, 2011 9:03 AM -
Re-,
I think I solved it! After the job submission failed because of the wrong credentials, you job is nevertheless ready to be submitted. Therefore, you can just open the "HPC Job Manager", go to the menu "Options" -> click "Clear Cached Job Credentials". Then find your job (state=configuring), right-click on it and submit it, entering the correct credentials and making sure you tick the box to save them. After that, it works perfectly.
But it would be nice to not get a StackOverflow error when the credentials are not saved in the first place!
Regards,
--
Christophe
- Proposed as answer by tristof Tuesday, January 25, 2011 10:20 AM
Tuesday, January 25, 2011 10:20 AM