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

Mutiple crash due to swift optimization setting. #92

Closed
buguibu opened this issue Apr 11, 2018 · 10 comments
Closed

Mutiple crash due to swift optimization setting. #92

buguibu opened this issue Apr 11, 2018 · 10 comments

Comments

@buguibu
Copy link

buguibu commented Apr 11, 2018

Just download the recent master release, run on whatever device with release scheme or enable "Optimize for Speed" optimization level swift setting, and you will get different crashes based on which demo you try.
captura de pantalla 2018-04-11 a las 16 05 56
captura de pantalla 2018-04-11 a las 16 05 21

@mchoe
Copy link
Owner

mchoe commented Apr 12, 2018

Hi @buguibu, I just tried this with XCode 9.3 on the latest release and am not able to reproduce. Can you attach a stack trace? Thanks.

@buguibu
Copy link
Author

buguibu commented Apr 12, 2018

Hi @mchoe this is strange, so i've just reproduce it again even cleaning derived data and reseting simulator, so more details:

  • running XCode 9.3
  • SwiftSVG-master
  • iPhone 6 11.3 Simulator
  • Build configuration Release or Debug but with SWIFT_OPTIMIZATION_LEVEL = "-Onone";
  • When choosing "Examples from GitHub"
  • Crash at NSXMLSVGParser.swift: 144
    (lldb) po Thread.callStackSymbols SwiftSVG was compiled with optimization - stepping may behave oddly; variables may not be available. 2018-04-12 08:27:53.819799+0200 SwiftSVGExampleiOS[1722:32741] Unrecognized selector -[SwiftSVG.SVGGroup setName:] error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x73757073). The process has been returned to the state before expression evaluation.

Hope it helps!

@Robuske
Copy link

Robuske commented Apr 15, 2018

I have the same problem, but @buguibu I believe that you meant

Build configuration Release or Debug but with SWIFT_OPTIMIZATION_LEVEL = "-O";

Also, I've found that compilation mode needs to be set to Whole Module
And I'm using Swift 4.1, It probably has something to do with some of the changes
https://swift.org/blog/osize/

@Robuske
Copy link

Robuske commented Apr 18, 2018

I found a way of creating a temporary fix that you can commit to the project

# Temporary fix for SwiftSVG Crash
post_install do |installer|
  swiftSVG = installer.pods_project.targets.find { |target| target.name == 'SwiftSVG' }
  swiftSVG.build_configurations.each do |config|
    config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = "-Onone"
  end
end

afedor added a commit to afedor/SwiftSVG that referenced this issue Apr 23, 2018
@DamienBell
Copy link

DamienBell commented Apr 24, 2018

Just wanted to say I'm running into the exact same issue. It's an important one because it's a bug that only shows up in release builds. @Robuske solution worked for me.

@afedor
Copy link
Contributor

afedor commented Apr 24, 2018

FYI, here's a very simple macOS project which illustrates the crash. Oddly it doesn't crash all the time and not always in the same place, but it does crash most of the time

SwiftSVGOptCrash.zip

@alexbartisro
Copy link

+1, just found this issue today when distributing a build to stakeholders

@tobins
Copy link

tobins commented May 4, 2018

+1. Found that turning off swift optimizations with @Robuske addition to the project's Podfile worked.

@pavelgubarev
Copy link

Hi! We have the same problem with our project. Maybe this crashlog can help you:

The app with SwiftSVG works fine when we launch it on our devices with xCode. But when we make a build and distribute it with TestFlight we have this error (from Crahslytics).

#0Crashed: com.straussmade.swiftsvgEXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000018 Raw Text

0 | SwiftSVG | Identifiable.swift line 74_T08SwiftSVG12IdentifiablePA2A19SVGContainerElementRzrlE8identifyySS10identifier_tFAA8SVGGroupC_Tg5
1 | SwiftSVG | SVGParserSupportedElements.swift line 0_T08SwiftSVG12IdentifiablePA2A19SVGContainerElementRzrlE8identifyySS10identifier_tFAA8SVGGroupC_Tg5TA
2 | SwiftSVG | SVGParserSupportedElements.swift line 0_T0SSIegx_SSytIegir_TRTA
3 | SwiftSVG | NSXMLSVGParser.swift line 142specialized NSXMLSVGParser.parser(:didStartElement:namespaceURI:qualifiedName:attributes:)
4 | SwiftSVG | NSXMLSVGParser.swift line 0@objc NSXMLSVGParser.parser(
:didStartElement:namespaceURI:qualifiedName:attributes:)

Line number 74 in Identifiable.swift is self.containerLayer.name = identifier

@buguibu
Copy link
Author

buguibu commented Nov 12, 2019

This doesn't use to happen me again.

@buguibu buguibu closed this as completed Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants