Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seg Fault when generating types #373

Closed
arno14 opened this issue Jun 16, 2021 · 2 comments
Closed

Seg Fault when generating types #373

arno14 opened this issue Jun 16, 2021 · 2 comments

Comments

@arno14
Copy link

arno14 commented Jun 16, 2021

I am trying to setup a project using this wsdl:
https://service-test.protel.io/services/ProtelApiService.ProtelApiServiceHttpsSoap12Endpoint?wsdl

I generate the soap-client.php file with command "wizard" , and then run the command "generate:types"

then I encouter a Segmentation Fault:
Erreur de segmentation (core dumped)

I tested on:

  • version 1.3 and php 7.4 with docker
  • version 1.6 and php 8

I tried to :

The others command "generate:classmap", "generate:client" fail the same way

I tried to debug using: https://jolicode.com/blog/find-segfaults-in-php-like-a-boss
I can see that the script get locked a few seconds on:
Phpro/SoapClient/Soap/Driver/ExtSoap/AbusedClient.php +43
then it continues and stop at
Phpro/SoapClient/Soap/Driver/ExtSoap/Metadata/XsdTypesParser.php +39

I think that the problem is relevant to the size of Soap Web service, and the fact that it references too many other xml files.

Are there any secret option that would allow to only generate the code for a short list of SOAP Operation and associated Types?

@veewee
Copy link
Contributor

veewee commented Jun 16, 2021

Hello @arno14,

This looks like an issue in ext-soap and you might report it on https://bugs.php.net/.

<?php
$client = new SoapClient('https://service-test.protel.io/services/ProtelApiService.ProtelApiServiceHttpsSoap12Endpoint?wsdl');
$client->__getTypes();

This results in a segfault:
[1] 33218 segmentation fault php

Debugging it doesnt give me any additional information either:

(lldb) run scratch_8.php
Process 38107 launched: '/usr/local/bin/php' (x86_64)
Process 38107 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00007fff6bdd8e52 libsystem_platform.dylib`_platform_strlen + 18
libsystem_platform.dylib`_platform_strlen:
->  0x7fff6bdd8e52 <+18>: pcmpeqb (%rdi), %xmm0
    0x7fff6bdd8e56 <+22>: pmovmskb %xmm0, %esi
    0x7fff6bdd8e5a <+26>: andq   $0xf, %rcx
    0x7fff6bdd8e5e <+30>: orq    $-0x1, %rax

The WSDL does load quite fast in soapUI, so I guess that the WSDL itself is ok.

However, when I tried running it through a vanilla PHP wsdl parser, I also get a segfault:

LOADING :https://service-test.protel.io/services/ProtelApiService.ProtelApiServiceHttpsSoap12Endpoint?wsdl
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNG_ChargePostingRQ.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNG_CommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelCommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_Profile.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelPreferences.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonPrefs.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNGExtensions.xsd
[1]    51648 segmentation fault  php ./bin/wsdl.php

However, If I disable HTTP cache in that custom parser, it keeps stuck in a loop:

LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelCommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_Profile.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelPreferences.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonPrefs.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNGExtensions.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelCommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_Profile.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelPreferences.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonPrefs.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNGExtensions.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelCommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_Profile.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelPreferences.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonPrefs.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNGExtensions.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelCommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_Profile.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelPreferences.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonPrefs.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=HTNGExtensions.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelCommonTypes.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_Profile.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_HotelPreferences.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonPrefs.xsd
LOADING :https://service-test.protel.io/services/ProtelApiService?xsd=OTA_CommonTypes.xsd

So my best guess is that it gets stuck in some circular import and crashes at some point because it keeps on importing/including XML until it crashes or doenst make sense anymore?

Probably SoapUI is clever enough to detect and fix this.

@arno14
Copy link
Author

arno14 commented Jun 17, 2021

Hi @veewee

Thanks you for your time and for pointing out to me that the problem was with the PHP SOAP extension itself.

For comparaison, I created a test script in node js for the same url, it works (it display the list of methods), unless it is very slow.

I opened a ticket on php.net: https://bugs.php.net/bug.php?id=81154&thanks=4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants