Microsoft Virtualization Discussions

Connect-NaController odd bug

bsti
9,695 Views

Hello all, I believe I've stumbled upon a bug in the Connect-NaController cmdlet in the toolkit.  To reproduce the issue, run the following code chunk:

Import-Module DataONTAP -Verbose

Connect-NaController "toaster"

You should get the following error:

Connect-NaController : Could not find file 'C:\Users\username\AppData\Local\Temp\m2tkuh8b.dll'.

At line:1 char:21

+ Connect-NaController <<<<  ah-3040-1

    + CategoryInfo          : NotSpecified: (:) [Connect-NaController], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,DataONTAP.PowerShell.SDK.ConnectNaController

Unfortunately, my script was several hundred lines of code, in which I was setting the $VerbosePreference variable to "Continue" (effectively the same as calling -Verbose on all cmdlets) and also had issues making the connection between the vague error message above and its cause so it took quite a bit of effort to find the root cause.

Hopefully, this can be addressed in an update.  Thanks!

12 REPLIES 12

cknight
9,647 Views

I cannot reproduce this.  Using your example, if "toaster" doesn't exist, here is the expected result:


PS C:\Software\Toolkit\1.2.0> Connect-NaController "toaster"


Connect-NaController : No such host is known
At line:1 char:21
+ Connect-NaController <<<<  "toaster"
    + CategoryInfo          : NotSpecified: (:) [Connect-NaController], SocketException
    + FullyQualifiedErrorId : System.Net.Sockets.SocketException,DataONTAP.PowerShell.SDK.ConnectNaController

-- or possibly --

PS C:\Software\Toolkit\1.2.0> Connect-NaController "toaster"

Connect-NaController : The requested name is valid, but no data of the requested type was found
At line:1 char:21
+ Connect-NaController <<<<  "toaster2"
    + CategoryInfo          : NotSpecified: (:) [Connect-NaController], SocketException
    + FullyQualifiedErrorId : System.Net.Sockets.SocketException,DataONTAP.PowerShell.SDK.ConnectNaController

If "toaster" isn't a Data ONTAP controller, you might see:

PS C:\Software\Toolkit\1.2.0> Connect-NaController "toaster"


Connect-NaController : RPC Error - The RPC server is unavailable.
At line:1 char:21
+ Connect-NaController <<<<  "toaster"
    + CategoryInfo          : InvalidResult: (NetApp.Ontapi.Filer.NaController:NaController) [Connect-NaController], EAPITRANSMISSION
    + FullyQualifiedErrorId : RpcConnectionFailed,DataONTAP.PowerShell.SDK.ConnectNaController

The DLL in your error message is unrelated to the Toolkit, so I suspect an issue with your local environment.  There was a similar report recently that turned out to be something other than a Toolkit issue.  A failure in Connect-NaController doesn't always throw a terminating error, so it's a good idea to either check for a null result or specify "-ErrorAction Stop" if that's what you want.

bsti
9,647 Views

Thanks for the reply.

I used "toaster" as an example in the code chunk I posted.  The name I used was the correct name for a filer in my environment, so that's not the nature of my issue.  Did you try to reproduce this with a valid filer name?

I was able to reproduce this on my development machine, and a foreign machine with a fresh install of the ONTAP toolkit (to be sure).  The .dll referenced in the error is interesting.  The name is completely random, and is different every time the error is thrown.  It's evidently some sort of dynamically-generated name, but for what purpose I've no idea.

This throws the error:

Import-Module DataONTAP -Verbose

Connect-NaController "your filer name here"

This does not:

Import-Module DataONTAP

Connect-NaController "your filer name here"

It's really strange.

I have the DataONTAP toolkit copied to C:\Windows\System32\WindowsPowershell\v1.0\Modules\DataONTAP folder.

I'm running 1.2 version of the toolkit.

cknight
9,647 Views

OK, thanks for that clarification.  With that, I can reproduce the issue.  It seems to be a strange interaction between PowerShell and the .NET XmlSerializer class.  The latter is what generates the randomly-named DLL files at runtime in the temp directory.  The workaround for the time being is to not load the module using -Verbose.

bsti
9,647 Views

Good.  I'm glad you were able to find it.

Thanks!

cknight
9,647 Views

I'm glad you were able to find it.

To clarify, I can reproduce the issue, but I don't understand the root cause of the issue or have a fix.  This is the failing line:

XmlSerializer serializer = new XmlSerializer(req.GetType());

But there is no good reason this .NET class should throw an exception in its constructor just because a PowerShell module was loaded with a -Verbose switch!

amirm
9,647 Views

Any resolution for this issue? Am also facing the same error. However everytime the .dll file name is diferent in the error message. Also am using ONATP Simulator.

Thanks,

-Amir

amirm
9,647 Views

Also without "-verbose" option am getting following error:

PS C:\Windows\system32> Import-Module DataONTAP

PS C:\Windows\system32> Connect-NaController ntap1

Connect-NaController : RPC Error - The RPC server is unavailable.

At line:1 char:21

+ Connect-NaController <<<<  ntap1

    + CategoryInfo          : InvalidResult: (ntap1:NaController) [Connect-NaController], EAPITRANSMISSION

    + FullyQualifiedErrorId : RpcConnectionFailed,DataONTAP.PowerShell.SDK.ConnectNaController

Am runing PS on Win7E

Thanks,

-Amir

amirm
9,647 Views

Finally resolved th issue using your post on other thread(cifs setup):

http://communities.netapp.com/thread/11573

Also some httpd options were needed to be turned on: httpd.admin.*

BTW is this issue been root caused/resolved?

Thanks,

-Amir

cknight
9,647 Views

The subsequent errors seen after loading the DataONTAP module with the -Verbose switch are a known issue in PowerShell; it is reportedly fixed in PowerShell 3.0 CTP1.

owenupton
8,020 Views

I'm hitting the same sort of problem using 1.6 and 1.7 versions of the toolkit with Powershell 2.
Calling a cmdlet such as Get-NASnapmirror, after connecting to the filers with Connect-NAController, gives me a temporary dll generation error such as:

Could not find file 'C:\Users\<userDir>\AppData\Local\Temp\2\tlxjisaf.dll

Once the error has been thrown, subsequent cmdlets all fail in the same way for the Powershell session.

After a reboot of the host I'm running the Powershell script on, I can usually get the script to behave for a while, but after a few runs the problem reappears.

I can work around the problem by using Powershell 3 CTP2 in place of Powershell 2, which so far has been reliable, but PS3 CTP2 won't be deployed to our production or staging environments.

Would generating serialization helper assemblies with sgen.exe possibly fix this issue when running with PS2?

Toolkit is excellent, btw - many thanks!

kind regards

Owen

timothyn
8,020 Views

If you aren't seeing this consistently and only a reboot helps, I suspect you might be running out of space where your %TEMP% directory is.  Can you confirm that there is plenty of room there (usually C:\)?

-Eric

owenupton
8,020 Views

Hi Eric.  Thanks for the prompt reply. C:\ has 13.2GB free on the Powershell 2 / Windows 2008 R2 host that I'm testing with.

Regards, Owen

Public