[Paraview] C++ Catalyst vtkSocket::Receive stuck in loop on Windows
Andy Bauer
andy.bauer at kitware.com
Mon Jul 10 16:20:47 EDT 2017
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 <+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/20170710/6a9d4934/attachment.html>
More information about the ParaView
mailing list