SystemStackError trying to call `.to_yaml` in a cequel objectCalling shell commands from RubyUniversal object cloning solutionRuby: Calling class method from instanceWhen monkey patching a method, can you call the overridden method from the new implementation?SystemStackError at the rack level in Ruby 1.9.2, not 1.8.7Ruby module variable accessor not working as expectedDetermining type of an object in rubyRuby Array#to_yaml doesn't call to_yaml recursivelyHow to store dynamically generated ruby has to cassandra using cequel?use map or list types in cequel

What defenses are there against being summoned by the Gate spell?

The use of multiple foreign keys on same column in SQL Server

Why don't electron-positron collisions release infinite energy?

What are these boxed doors outside store fronts in New York?

How is it possible to have an ability score that is less than 3?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

Do I have a twin with permutated remainders?

Mage Armor with Defense fighting style (for Adventurers League bladeslinger)

Why, historically, did Gödel think CH was false?

Fencing style for blades that can attack from a distance

LaTeX closing $ signs makes cursor jump

How could an uplifted falcon's brain work?

Font hinting is lost in Chrome-like browsers (for some languages )

Show that if two triangles built on parallel lines, with equal bases have the same perimeter only if they are congruent.

Risk of getting Chronic Wasting Disease (CWD) in the United States?

Schoenfled Residua test shows proportionality hazard assumptions holds but Kaplan-Meier plots intersect

In Japanese, what’s the difference between “Tonari ni” (となりに) and “Tsugi” (つぎ)? When would you use one over the other?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

How does strength of boric acid solution increase in presence of salicylic acid?

Watching something be written to a file live with tail

Is a tag line useful on a cover?

Mathematical cryptic clues

What's the output of a record cartridge playing an out-of-speed record

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?



SystemStackError trying to call `.to_yaml` in a cequel object


Calling shell commands from RubyUniversal object cloning solutionRuby: Calling class method from instanceWhen monkey patching a method, can you call the overridden method from the new implementation?SystemStackError at the rack level in Ruby 1.9.2, not 1.8.7Ruby module variable accessor not working as expectedDetermining type of an object in rubyRuby Array#to_yaml doesn't call to_yaml recursivelyHow to store dynamically generated ruby has to cassandra using cequel?use map or list types in cequel






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I started to work in a legacy project and if I try to find a cequel record and then convert it to yaml:



fj = FullJob.find(1)
fj.to_yaml


I'm getting a stack level too deep error.
Checking deeper, there's a @record_collection instance variable defined in the cequel record, which it brings a copy of the same object and inside of this, another copy of the same and so on...:



[7] pry(main)> fj.instance_variables
=> [:@record_collection, :@cequel_attributes, :@collection_proxies, :@loaded, :@persisted]
[8] pry(main)> fj.instance_variable_get(:@record_collection)
=> [#<FullJob id: 1, #...
[9] pry(main)> fj.instance_variable_get(:@record_collection).first.instance_variable_get(:@record_collection)
=> [#<FullJob id: 1, #...


The problem is, the ruby yaml parser, at some point, tries to parse all the instance variables of an object, which eventually derives in the mentioned SystemStackError.

Worth to mention this is only happening in this specific model, I mean, as far as I've seen, the @record_collection variable comes nil for another cequel models present in this project.

Not sure at all how this works, if this is a cequel bug or something not properly configured in the model, but... maybe has to do with cequel lazy loading?, anyway I'm running out of ideas here :(










share|improve this question




























    1















    I started to work in a legacy project and if I try to find a cequel record and then convert it to yaml:



    fj = FullJob.find(1)
    fj.to_yaml


    I'm getting a stack level too deep error.
    Checking deeper, there's a @record_collection instance variable defined in the cequel record, which it brings a copy of the same object and inside of this, another copy of the same and so on...:



    [7] pry(main)> fj.instance_variables
    => [:@record_collection, :@cequel_attributes, :@collection_proxies, :@loaded, :@persisted]
    [8] pry(main)> fj.instance_variable_get(:@record_collection)
    => [#<FullJob id: 1, #...
    [9] pry(main)> fj.instance_variable_get(:@record_collection).first.instance_variable_get(:@record_collection)
    => [#<FullJob id: 1, #...


    The problem is, the ruby yaml parser, at some point, tries to parse all the instance variables of an object, which eventually derives in the mentioned SystemStackError.

    Worth to mention this is only happening in this specific model, I mean, as far as I've seen, the @record_collection variable comes nil for another cequel models present in this project.

    Not sure at all how this works, if this is a cequel bug or something not properly configured in the model, but... maybe has to do with cequel lazy loading?, anyway I'm running out of ideas here :(










    share|improve this question
























      1












      1








      1








      I started to work in a legacy project and if I try to find a cequel record and then convert it to yaml:



      fj = FullJob.find(1)
      fj.to_yaml


      I'm getting a stack level too deep error.
      Checking deeper, there's a @record_collection instance variable defined in the cequel record, which it brings a copy of the same object and inside of this, another copy of the same and so on...:



      [7] pry(main)> fj.instance_variables
      => [:@record_collection, :@cequel_attributes, :@collection_proxies, :@loaded, :@persisted]
      [8] pry(main)> fj.instance_variable_get(:@record_collection)
      => [#<FullJob id: 1, #...
      [9] pry(main)> fj.instance_variable_get(:@record_collection).first.instance_variable_get(:@record_collection)
      => [#<FullJob id: 1, #...


      The problem is, the ruby yaml parser, at some point, tries to parse all the instance variables of an object, which eventually derives in the mentioned SystemStackError.

      Worth to mention this is only happening in this specific model, I mean, as far as I've seen, the @record_collection variable comes nil for another cequel models present in this project.

      Not sure at all how this works, if this is a cequel bug or something not properly configured in the model, but... maybe has to do with cequel lazy loading?, anyway I'm running out of ideas here :(










      share|improve this question














      I started to work in a legacy project and if I try to find a cequel record and then convert it to yaml:



      fj = FullJob.find(1)
      fj.to_yaml


      I'm getting a stack level too deep error.
      Checking deeper, there's a @record_collection instance variable defined in the cequel record, which it brings a copy of the same object and inside of this, another copy of the same and so on...:



      [7] pry(main)> fj.instance_variables
      => [:@record_collection, :@cequel_attributes, :@collection_proxies, :@loaded, :@persisted]
      [8] pry(main)> fj.instance_variable_get(:@record_collection)
      => [#<FullJob id: 1, #...
      [9] pry(main)> fj.instance_variable_get(:@record_collection).first.instance_variable_get(:@record_collection)
      => [#<FullJob id: 1, #...


      The problem is, the ruby yaml parser, at some point, tries to parse all the instance variables of an object, which eventually derives in the mentioned SystemStackError.

      Worth to mention this is only happening in this specific model, I mean, as far as I've seen, the @record_collection variable comes nil for another cequel models present in this project.

      Not sure at all how this works, if this is a cequel bug or something not properly configured in the model, but... maybe has to do with cequel lazy loading?, anyway I'm running out of ideas here :(







      ruby ruby-on-rails-4 cequel psychparser






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 3:53









      Alter LagosAlter Lagos

      6,68214570




      6,68214570






















          1 Answer
          1






          active

          oldest

          votes


















          1















          Worth to mention this is only happening in this specific model




          It's not, actually. I think it happens to any record that was lazily instantiated as "unloaded" first and then loaded later - its @record_collection stays there even after loading (at least, I reproduced the same failure this way easily).



          I can't find any single place in cequel source code where they drop this instance variable value (it doesn't happen on load for sure). On the other hand, it seems this value is not being used anywhere else except this lazy load behavior (so it's kind of "useless" after the record is loaded), so it might be safe to go with ugly monkey-patching workaround helper like



          def cequel_to_yaml(record)
          record.load unless record.loaded?
          record.instance_variable_set(:@record_collection, nil)
          record.to_yaml
          end





          share|improve this answer

























          • I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

            – Alter Lagos
            Mar 11 at 2:53











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056476%2fsystemstackerror-trying-to-call-to-yaml-in-a-cequel-object%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1















          Worth to mention this is only happening in this specific model




          It's not, actually. I think it happens to any record that was lazily instantiated as "unloaded" first and then loaded later - its @record_collection stays there even after loading (at least, I reproduced the same failure this way easily).



          I can't find any single place in cequel source code where they drop this instance variable value (it doesn't happen on load for sure). On the other hand, it seems this value is not being used anywhere else except this lazy load behavior (so it's kind of "useless" after the record is loaded), so it might be safe to go with ugly monkey-patching workaround helper like



          def cequel_to_yaml(record)
          record.load unless record.loaded?
          record.instance_variable_set(:@record_collection, nil)
          record.to_yaml
          end





          share|improve this answer

























          • I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

            – Alter Lagos
            Mar 11 at 2:53















          1















          Worth to mention this is only happening in this specific model




          It's not, actually. I think it happens to any record that was lazily instantiated as "unloaded" first and then loaded later - its @record_collection stays there even after loading (at least, I reproduced the same failure this way easily).



          I can't find any single place in cequel source code where they drop this instance variable value (it doesn't happen on load for sure). On the other hand, it seems this value is not being used anywhere else except this lazy load behavior (so it's kind of "useless" after the record is loaded), so it might be safe to go with ugly monkey-patching workaround helper like



          def cequel_to_yaml(record)
          record.load unless record.loaded?
          record.instance_variable_set(:@record_collection, nil)
          record.to_yaml
          end





          share|improve this answer

























          • I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

            – Alter Lagos
            Mar 11 at 2:53













          1












          1








          1








          Worth to mention this is only happening in this specific model




          It's not, actually. I think it happens to any record that was lazily instantiated as "unloaded" first and then loaded later - its @record_collection stays there even after loading (at least, I reproduced the same failure this way easily).



          I can't find any single place in cequel source code where they drop this instance variable value (it doesn't happen on load for sure). On the other hand, it seems this value is not being used anywhere else except this lazy load behavior (so it's kind of "useless" after the record is loaded), so it might be safe to go with ugly monkey-patching workaround helper like



          def cequel_to_yaml(record)
          record.load unless record.loaded?
          record.instance_variable_set(:@record_collection, nil)
          record.to_yaml
          end





          share|improve this answer
















          Worth to mention this is only happening in this specific model




          It's not, actually. I think it happens to any record that was lazily instantiated as "unloaded" first and then loaded later - its @record_collection stays there even after loading (at least, I reproduced the same failure this way easily).



          I can't find any single place in cequel source code where they drop this instance variable value (it doesn't happen on load for sure). On the other hand, it seems this value is not being used anywhere else except this lazy load behavior (so it's kind of "useless" after the record is loaded), so it might be safe to go with ugly monkey-patching workaround helper like



          def cequel_to_yaml(record)
          record.load unless record.loaded?
          record.instance_variable_set(:@record_collection, nil)
          record.to_yaml
          end






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 13:26

























          answered Mar 8 at 13:06









          Konstantin StrukovKonstantin Strukov

          1914




          1914












          • I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

            – Alter Lagos
            Mar 11 at 2:53

















          • I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

            – Alter Lagos
            Mar 11 at 2:53
















          I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

          – Alter Lagos
          Mar 11 at 2:53





          I'm glad you had the same problem as me :D . In the meantime I'm gonna try your monkey-patch and report it to cequel as a bug to see if I have better luck.

          – Alter Lagos
          Mar 11 at 2:53



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056476%2fsystemstackerror-trying-to-call-to-yaml-in-a-cequel-object%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович