[Paraview] C++ Catalyst vtkSocket::Receive stuck in loop on Windows

Simon Klarmann klarmann at mechanik.tu-darmstadt.de
Tue Jul 11 08:04:30 EDT 2017


Hi Andy,

 

I want to be able to close the connection from both sides. Closing the connection from the Insitu side works by calling vtkLiveInsituLink::DropLiveInsituConnection().

Closing the connection from the Live side, e.g. by closing the GUI, causes my application to hang in the vtkSocket::Receive() method.

 

After enabling the Debug mode I get the following Error on the Insitu side:

“ERROR: In D:\build\ParaView-v5.4.0\VTK\Common\System\vtkSocket.cxx, line 572

vtkClientSocket (0000000008BFFC00): Socket error in call to send. Eine bestehende Verbindung wurde softwaregesteuert durch den Hostcomputer abgebrochen.”

 

„Eine bestehende Verbindung wurde softwaregesteuert durch den Hostcomputer abgebrochen“ 

This seems to be a windows specific message notifying about a software controlled termination of the connection. So the information of the termination of the connection is somewhere available. The method throwing this error is the vtkSocket::Send() method. 

 

This error shows up as soon as I close the connection from the Live side (GUI) and then perform an InsituUpdate on the Insitu side. Still after this message, my Insitu side runs into vtkSocket::Receive() and get stuck there, trying to receive data.

 

 

Additional Info: 

Performing the live visualization with the vtkCPPythonAdapter leads to the same error message and a crash of the Insitu application.

 

Attached is a minimalistic working example. In both cases the error happens.

 

Steps to reproduce:

1.       Start Paraview ->Catalyst->Connect

2.       Start the application, choose either 0 for python or 1 for cpp, then the PVTrivialproducer should show up in Paraview

3.       Close Paraview

4.       Continue the application ->crash

 

 

I hope this helps a little bit to get an insight on what I did.

 

Thanks,

Simon

 

 

 

 

Von: Andy Bauer [mailto:andy.bauer at kitware.com] 
Gesendet: Montag, 10. Juli 2017 22:21
An: Simon Klarmann
Cc: paraview at paraview.org
Betreff: Re: [Paraview] C++ Catalyst vtkSocket::Receive stuck in loop on Windows

 

Hi,

 

Are you trying to close the connection from the in situ side? The design was for the connection to be close through the GUI.

 

It's difficult to say what exactly is going on here without getting fairly deep into the problem. Theoretically though it should be possible to do the Live link in C++ as most of the Python routines call wrapped C++ routines. 

 

There should be some way to figure out the status of the connection on the PV server (the builtin server if you're not connected to a separate pvserver process) either the NotifyClientDisconnected() method, or vtkLiveInsituLink::OnConnectionClosedEvent() or vtkLiveInsituLink::DropLiveInsituConnection() member functions. 

 

Cheers,

Andy

 

On Mon, Jul 10, 2017 at 10:34 AM, Simon Klarmann <klarmann at mechanik.tu-darmstadt.de> wrote:

Sorry I think I have chosen the wrong reply method.

 

Hi Andy,

 

I already got rid of Python on both sides. CoProcessing with Live connection is working by directly using the vtkLiveInsituLink (pure C++ implementation).

 

Working with both Paraview 5.2  and 5.4.

 

My problem is closing the connection on the Live side (e.g. closing Paraview). Doing so, my Insitu side hangs (when trying again to send data, m_link->InsituUpdate, see below) in the receive method of the vtkSocket class until at some point an integer underflow happens.

 

Closing the connection from the Insitu side everything works as expected. 

 

Are there any methods to directly check if the connection is still alive?

Or is it a Windows specific problem?

 

 

 

Additionally the steps for the live connection in C++, for sure there may be more elegant ways:

 

// Initialization

 

vtkCPProcessor  *m_proc = vtkCPProcessor::New();

                m_proc->Initialize();

 

                vtkLiveInsituLink  *m_link = vtkLiveInsituLink::New();

                m_link->SetInsituPort(22222);

                m_link->SetHostname("localhost");

                m_link->SetProcessType(vtkLiveInsituLink::INSITU);

 

                vtkSMProxyManager  *m_spxm = vtkSMProxyManager::GetProxyManager()->GetActiveSessionProxyManager();

                vtkSMProxy *m_px = m_spxm->NewProxy("sources", "PVTrivialProducer");

                vtkSMSourceProxy *m_spx = vtkSMSourceProxy::SafeDownCast(m_px);

                m_spxm->RegisterProxy("sources", m_spx);

 

                vtkObjectBase *obase = m_spx->GetClientSideObject();

                vtkPVTrivialProducer *prod =

                               vtkPVTrivialProducer::SafeDownCast(obase);

                prod->SetOutput(m_toplot, m_time);    // m_toplot is a vtkMultiBlockDataSet

 

                m_link->Initialize(m_spxm);

 

                

                //Update the live side

                m_link->InsituUpdate(m_time, m_tstep);

m_spx->UpdatePipeline(m_time);

m_link->InsituPostProcess(m_time,m_tstep);

 

 

Thanks,

Simon

 

 

 

 

 

Von: Andy Bauer [mailto:andy.bauer at kitware.com] 
Gesendet: Donnerstag, 6. Juli 2017 17:14
An: Simon Klarmann
Cc: paraview at paraview.org
Betreff: Re: [Paraview] C++ Catalyst vtkSocket::Receive stuck in loop on Windows

 

Hi Simon,

 

Is the Python dependency that you're trying to get rid of on the Catalyst side or on the pvserver/GUI side? If I remember correctly on the Catalyst side Python was required for the Live connection. 

 

Cheers,

Andy

 

On Wed, Jul 5, 2017 at 10:11 AM, Simon Klarmann <klarmann at mechanik.tu-darmstadt.de> wrote:

Dear Members,

 

I wanted to get rid of the dependency on Python. The connection by pure C++ works just fine.

 

The problem occurs when establishing the live connection to Paraview, closing Paraview and then try to send some data again.

I tracked it down to the vtkSocket class inside the method Receive. After the connection is terminated on the Paraview side, e.g. by closing Paraview, the call of vtkLiveInsituLink::InsituUpdate gets stuck in the vtkSocket::Receive method. Even though I get a message that the connection was terminated.

 

A temporary fix for my case was to replace in Line 609 of the vtkSocket.cxx if (nRecvd == 0) with if (nRecvd <= 0), because on disconnection the return value of nRecvd is -1. Then everything works well.

 

I only used the following methods in the given order to transfer the data:

 

vtkLiveInsituLink::InsituUpdate

vtkSMSourceProxy::UpdatePipeline

vtkLiveInsituLink::InsituPostProcess

 

 

Are there further steps to perform or is there a way to check if the connection is still alive?

 

 

Operating System: Windows 7, Visual Studio 2017

 

Thanks,

Simon

 

 

 

 

Dipl.-Ing. Simon Klarmann

 

Bau- und Umweltingenieurwissenschaften
Technische Universität Darmstadt

Fachgebiet Festkörpermechanik

 

Tel.: +49 6151 16 – 22642 <tel:+49%206151%201622642> 

Mail: klarmann at mechanik.tu-darmstadt.de

Franziska-Braun-Straße 7

Gebäude L5|01, Raum 542

64287 Darmstadt

 


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170711/f76afcbb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CatalystTest.zip
Type: application/x-zip-compressed
Size: 2830 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170711/f76afcbb/attachment.bin>


More information about the ParaView mailing list