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

Simultaneous accesses to 0x107e947c8, but modification requires exclusive access : Swift 5 #1800

Closed
iStorry opened this issue Apr 1, 2019 · 7 comments

Comments

@iStorry
Copy link

iStorry commented Apr 1, 2019

Simultaneous accesses to 0x107e947c8, but modification requires exclusive access.
Previous access (a modification) started at Eureka`BaseRow.section.modify + 92 (0x10621aff0).
Current access (a read) started at:
0    libswiftCore.dylib                 0x00000001ecec6a54 swift_beginAccess + 556
1    Eureka                             0x000000010621aecc BaseRow.section.getter + 48
2    Eureka                             0x000000010621c744 BaseRow.indexPath.getter + 132
3    GayaR                              0x00000001049a8f2c closure #4 in QNA.viewDidLoad() + 4080
4    Eureka                             0x00000001062e1514 closure #1 in RowType<>.onRowValidationChanged(_:) + 464
5    Eureka                             0x0000000106217d40 BaseRow.validationErrors.didset + 1176
6    Eureka                             0x0000000106218314 BaseRow.validationErrors.setter + 244
7    Eureka                             0x00000001062d6fc0 RowOf.validate() + 432
8    Eureka                             0x00000001062a1b80 closure #2 in Form.validate(includeHidden:includeDisabled:) + 168
9    Eureka                             0x00000001062a1ca4 thunk for @callee_guaranteed (@guaranteed [ValidationError], @guaranteed BaseRow) -> (@owned [ValidationError], @error @owned Error) + 44
10   Eureka                             0x00000001062a2dc8 partial apply for thunk for @callee_guaranteed (@guaranteed [ValidationError], @guaranteed BaseRow) -> (@owned [ValidationError], @error @owned Error) + 40
11   libswiftCore.dylib                 0x00000001ecd68e9c Sequence.reduce<A>(_:_:) + 700
12   Eureka                             0x00000001062a1850 Form.validate(includeHidden:includeDisabled:) + 616
13   GayaR                              0x00000001049adde8 closure #12 in QNA.viewDidLoad() + 692
14   Eureka                             0x00000001062e0c9c closure #1 in RowType<>.onCellSelection(_:) + 464
15   Eureka                             0x00000001062d9ae0 Row.didSelect() + 444
16   Eureka                             0x000000010623f420 FormViewController.tableView(_:didSelectRowAt:) + 1340
17   Eureka                             0x000000010623f980 @objc FormViewController.tableView(_:didSelectRowAt:) + 176
18   UIKitCore                          0x00000001ebf03158 <redacted> + 1344
19   UIKitCore                          0x00000001ebf037f0 <redacted> + 272
20   UIKitCore                          0x00000001ebd03978 <redacted> + 304
21   UIKitCore                          0x00000001ebcf1b0c <redacted> + 356
22   UIKitCore                          0x00000001ebd20000 <redacted> + 120
23   CoreFoundation                     0x00000001beda6ec4 <redacted> + 36
24   CoreFoundation                     0x00000001beda1840 <redacted> + 416
25   CoreFoundation                     0x00000001beda1a84 <redacted> + 1212
26   CoreFoundation                     0x00000001beda15a0 CFRunLoopRunSpecific + 452
27   GraphicsServices                   0x00000001c0fddd68 GSEventRunModal + 108
28   UIKitCore                          0x00000001ebcf7f34 UIApplicationMain + 216
29   GayaR                              0x00000001046b9998 main + 76
30   libdyld.dylib                      0x00000001be860ff8 <redacted> + 4
(lldb) 
@mtnbarreto
Copy link
Member

Hi! I just released a new eureka version. Let me know if it works...

@iStorry
Copy link
Author

iStorry commented Apr 2, 2019

Hi! I just released a new eureka version. Let me know if it works...

Sorry, i am still facing this issue.

Example

LabelRow.defaultCellUpdate = { cell, row in
      cell.contentView.backgroundColor = .red
      cell.textLabel?.textColor = .white
      cell.textLabel?.font = UIFont.boldSystemFont(ofSize: 13)
      cell.textLabel?.textAlignment = .right
 }

// MARK: - FormViewController Helpers
extension FormViewController {
    public func updateRow<Row>(row: Row.Type) where Row: RowType, Row: BaseRow, Row: FieldRowConformance {

        Row.defaultCellUpdate = { cell, row in
            if !row.isValid {
                cell.textLabel?.textColor = .red
            }
        }

        Row.defaultOnRowValidationChanged = { cell, row in
            let rowIndex = row.indexPath!.row
            while row.section!.count > rowIndex + 1 && row.section?[rowIndex  + 1] is LabelRow {
                row.section?.remove(at: rowIndex + 1)
            }
            if !row.isValid {
                for (index, validationMsg) in row.validationErrors.map({ $0.msg }).enumerated() {
                    let labelRow = LabelRow {
                        $0.title = validationMsg
                        $0.cell.height = { 30 }
                    }
                    row.section?.insert(labelRow, at: row.indexPath!.row + index + 1)
                }
            }
        }

    }
}

updateRow(row: EmailRow.self)

<< EmailRow(Login.email) { row in
      row.title = strings.email
      row.placeholder = strings.email_placeholder
      row.add(rule: RuleEmail(msg: strings.email_valid))
      row.add(rule: RuleRequired(msg: strings.required))
      row.validationOptions = .validatesOnDemand
}

Before it was working perfectly fine on swift 3.2 ~ 4.2

@TheOneAndOnlyGarcia
Copy link

TheOneAndOnlyGarcia commented Apr 2, 2019

same problem here (Eureka 4.3.1)

@mats-claassen mats-claassen reopened this Apr 2, 2019
@TheOneAndOnlyGarcia
Copy link

sorry, the community pod https://github.com/EurekaCommunity/ImageRow prevented an upgrade to the latest pod version. i hadn't checked that pod update didn't pull version 5.0.0.

at the moment I can't test if the error is still persistent, because the current version of my app relies on ImageRow

@mats-claassen
Copy link
Member

Hi, sorry for the inconveniences. We will be migrating the pods soon.

I could reproduce the issue in the examples. However it seems to have been an error in the example code rather than Eureka itself. In my case the following change fixed the problem:

// before
row.section?.insert(labelRow, at: row.indexPath!.row + index + 1)

// later
let indexPath = row.indexPath!.row + index + 1
row.section?.insert(labelRow, at: indexPath)

This is to avoid a simultaneous access to row.section which happens in the mutating insert and while accessing row.indexPath (which gets the index from the section).

@iStorry Your code looks to have the same issue

@iStorry
Copy link
Author

iStorry commented Apr 2, 2019

@mats-claassen yes, i found the other way as well but i will check your code soon. Thank you very much 👍

Pods -> Eureka -> Build Settings -> Swift Compiler - Code Generation
Change Exclusive Access to Memory : Full Enforcement -> Compile-time Enforcement Only

@iStorry
Copy link
Author

iStorry commented Apr 3, 2019

@mats-claassen thank you very much, it worked perfectly fine 👍

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

4 participants